cjeopardy: If answer is integral, then respond "too big!" or "too small!" respectively

This commit is contained in:
Pragmatic Software 2015-01-24 08:05:47 -08:00
parent f31ce372cc
commit c3dde27328
1 changed files with 10 additions and 0 deletions

View File

@ -114,6 +114,16 @@ foreach my $answer (@valid_answers) {
$supplemental_text = $1;
}
if ($answer =~ /^[0-9]+$/ and $lctext =~ /^[0-9]+$/) {
if ($lctext > $answer) {
print "$lctext is too big!\n";
exit;
} elsif ($lctext < $answer) {
print "$lctext is too small!\n";
exit;
}
}
my $distance = fastdistance($lctext, lc $answer);
my $length = (length($lctext) > length($answer)) ? length $lctext : length $answer;