def check(word)\r
w = word.downcase\r
debug "checking #{w} for #{@word} in #{@range}"\r
+ # Since we're called threaded, bail out early if a winner\r
+ # was assigned already\r
+ return [:ignore, nil] if @winner\r
return [:bingo, nil] if w == @word\r
return [:out, @range] if w < @range.first or w > @range.last\r
return [:ignore, @range] if w == @range.first or w == @range.last\r
+ # This is potentially slow (for languages that check online)\r
return [:noexist, @range] unless @plugin.send("is_#{@lang}?", w)\r
debug "we like it"\r
+ # Check again if there was a winner in the mean time,\r
+ # and bail out if there was\r
+ return [:ignore, nil] if @winner\r
if w < @word and w > @range.first\r
@range.first.replace(w)\r
return [:in, @range]\r
when :out\r
m.reply _("%{word} is not in the range %{bold}%{range}%{bold}") % {:word => word, :bold => Bold, :range => isit.last} if m.address?\r
when :noexist\r
+ # bail out early if the game was won in the mean time\r
+ return if !@games[k] or @games[k].winner\r
m.reply _("%{word} doesn't exist or is not acceptable for the game") % {:word => word}\r
@games[k].total_failed += 1\r
@games[k].failed[m.source] += 1\r
when :in\r
+ # bail out early if the game was won in the mean time\r
+ return if !@games[k] or @games[k].winner\r
m.reply _("close, but no cigar. New range: %{bold}%{range}%{bold}") % {:bold => Bold, :range => isit.last}\r
@games[k].total_tries += 1\r
@games[k].tries[m.source] += 1\r