diff --git a/08_Batnum/perl/batnum.pl b/08_Batnum/perl/batnum.pl index a384b963..4280bf38 100644 --- a/08_Batnum/perl/batnum.pl +++ b/08_Batnum/perl/batnum.pl @@ -237,7 +237,12 @@ sub computers_move { $pile_size -= $remove_amount; - printf "COMPUTER TAKES %d AND LEAVES %d.\n", $remove_amount, $pile_size; + if ($pile_size <= 0) { + printf "COMPUTER TAKES %d AND WINS.\n", $remove_amount; + return (1, $pile_size); + } else { + printf "COMPUTER TAKES %d AND LEAVES %d.\n", $remove_amount, $pile_size; + } return (0, $pile_size); }