mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-12 15:50:20 -08:00
modified the AI logic to make it a bit more difficult
This commit is contained in:
@@ -110,7 +110,7 @@ sub check_for_corners {
|
|||||||
@precedence=(1,9,7,3,5,2,4,6,8);
|
@precedence=(1,9,7,3,5,2,4,6,8);
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
foreach my $move (@precedence) {
|
||||||
my $validity=&check_occupation($move);
|
my $validity=&check_occupation($move);
|
||||||
@@ -166,7 +166,7 @@ sub check_occupation {
|
|||||||
|
|
||||||
sub print_board {
|
sub print_board {
|
||||||
foreach my $num (1..9) {
|
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";}
|
if ($num == 4 || $num == 7) { print "\n---+---+---\n";}
|
||||||
print "$char";
|
print "$char";
|
||||||
if ($num % 3 > 0) { print "!" }
|
if ($num % 3 > 0) { print "!" }
|
||||||
|
|||||||
Reference in New Issue
Block a user