From b59eba353407c14e84874021d39fb707612cdac8 Mon Sep 17 00:00:00 2001 From: ribtips Date: Fri, 11 Feb 2022 12:12:02 -0500 Subject: [PATCH] modified the AI logic to make it a bit more difficult --- 89_Tic-Tac-Toe/perl/tictactoe2.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/89_Tic-Tac-Toe/perl/tictactoe2.pl b/89_Tic-Tac-Toe/perl/tictactoe2.pl index 0cbf4c10..4bc7cc0b 100644 --- a/89_Tic-Tac-Toe/perl/tictactoe2.pl +++ b/89_Tic-Tac-Toe/perl/tictactoe2.pl @@ -110,7 +110,7 @@ sub check_for_corners { @precedence=(1,9,7,3,5,2,4,6,8); } else { - @precedence=(5,1,9,7,3,2,4,6,8); + @precedence=(5,2,4,6,8,1,9,7,3); } foreach my $move (@precedence) { my $validity=&check_occupation($move); @@ -166,7 +166,7 @@ sub check_occupation { sub print_board { foreach my $num (1..9) { - my $char = &which_char($board{$num}); + my $char = &which_char($board{$num}); if ($num == 4 || $num == 7) { print "\n---+---+---\n";} print "$char"; if ($num % 3 > 0) { print "!" }