PSEUDOCODE
TIC TAC TOE PSEUDOCODE
__________________________________________________________
if ( the move is a winning move ) {
make the winning move
} else {
check win or no more moves
}
__________________________________________________________
if ( the move is not a winning move ) {
check is the opponent’s next move a winning move
} else {
make a winning move
}
__________________________________________________________
if ( the opponent’s next move is a winning move ) {
block the opponent’s move
check win or no more moves
} else {
make high probability to win move
check win or no more moves
}
__________________________________________________________
if ( the move is not a winning move or the opponent’s next move is not a winning move ) {
make high probability to win move
} else {
make winning moves or block opponent’s move
check win or no more moves
}
__________________________________________________________
CORRECT SEMI SYNTAX
while (game not ended) {
if (this is a winning move) {
make winning move
} else if (opponent’s next move is a winning move) {
block opponent
} else {
make a good move
}
}