3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

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

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;