summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-01-25 19:29:47 -0500
committerdoy <doy@tozt.net>2009-01-25 19:29:47 -0500
commit3c42512cb37a98ad31b004f825e44dc2c30953ce (patch)
tree59771528610610274cf0329c4b449dfb9fe7411b
parentc1806329bc1dfefb924dda60498af26a3740da92 (diff)
downloadbot-games-3c42512cb37a98ad31b004f825e44dc2c30953ce.tar.gz
bot-games-3c42512cb37a98ad31b004f825e44dc2c30953ce.zip
stop using the stupid way to catch fractions (it would loop forever on prime numbers)
-rw-r--r--lib/Bot/Games/Game/24.pm5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/Bot/Games/Game/24.pm b/lib/Bot/Games/Game/24.pm
index ea4730b..b4604f4 100644
--- a/lib/Bot/Games/Game/24.pm
+++ b/lib/Bot/Games/Game/24.pm
@@ -71,10 +71,7 @@ sub generate_24 {
}
elsif ($op eq '*') {
$n2 = $val / $n1;
- while ($n2 != int($n2)) {
- $n1 = 2 + int rand($val - 3);
- $n2 = $val / $n1;
- }
+ redo if ($n2 != int($n2));
}
elsif ($op eq '/') {
$n1 *= $val;