C Jeopardy: Correct showing of text/answer in "close enough" output due to recent change in handling of typographical case

This commit is contained in:
Pragmatic Software 2014-07-29 20:21:06 +00:00
parent 236b4c1d06
commit 9651847165
2 changed files with 3 additions and 5 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 757,
BUILD_REVISION => 758,
BUILD_DATE => "2014-07-29",
};

View File

@ -47,14 +47,12 @@ foreach my $answer (@valid_answers) {
my $length = (length($text) > length($answer)) ? length $text : length $answer;
if ($distance / $length < 0.15) {
my $correctness;
if ($distance == 0) {
$correctness = "correct!";
print "'$answer' is correct!\n";
} else {
$correctness = "close enough to '$answer'. You are correct!"
print "'$text' is close enough to '$answer'. You are correct!\n"
}
print "'$answer' is $correctness\n";
unlink "$CJEOPARDY_DATA-$channel";
unlink "$CJEOPARDY_HINT-$channel";