mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-12 15:50:20 -08:00
Fixed game termination bug
Fixed issue where the game wouldn't terminate properly if the computer goes first.
This commit is contained in:
@@ -58,6 +58,10 @@ sub main {
|
||||
$count++;
|
||||
&print_board;
|
||||
&check_for_winners;
|
||||
if ($count >= 9) {
|
||||
print "IT'S A DRAW. THANK YOU.\n";
|
||||
exit;
|
||||
}
|
||||
&player_choice;
|
||||
$count++;
|
||||
&print_board;
|
||||
@@ -65,6 +69,7 @@ sub main {
|
||||
}
|
||||
}
|
||||
print "IT'S A DRAW. THANK YOU.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# This will check to see if anyone has won by adding up the various 3-in-a-row lines.
|
||||
|
||||
Reference in New Issue
Block a user