ARTIFICIAL INTELLIGENCE
TIC-TAC-TOE
Game
N a m e : M a n i k a k u m a r i
R o l l n o . : M T / C S / 1 0 0 0 6 / 1 8
G u i d e d b y : D r. S a n c h i t a P a u l
Introduction
TIC-TAC-TOE Game
1. Two player game – X and O
2. X and O, who take turns
mark the spaces in a 3×3
grid.
3. The player who succeeds in
placing three of their
marks in a horizontal,
vertical, or diagonal row
wins the game.
Initial State
Initially all 1 to 9 places of 3x3 grid are empty
1
4 5
3
6
7 8 9
2
Goal State
PLAYER X WIN
3 X’s in a column ,
row or diagonal
PLAYER O WIN
3 O’s in a column ,
row or diagonal
DRAW
X
O O
X X
OX
O
O O
X X
X
X
O
O
X
OXO
Winning Conditions
X X X
X X X
X X X
X
X
X
X
X
X X
X
X
X
X
X
X
X
X
State Space Tree
9 possibilities
X X X
X
X X X XO
O
O
O
8 possibilities
X
O
X
O
X
O
X
O
X
O
X X
X X
X
MINIMAX Approach
Minimax is a recursive algorithm which is used to choose an optimal
move for a player assuming that the other player is also playing
optimally.
Initial state: Initial position of the board/grid .
Successor function: I defines what the legal moves from any
position
Terminal state: I position of the board when the game gets over.
Utility function: I function which assigns a numeric value for the
outcome of a game.
For instance, in tic-tac-toe, the outcome is either a win, a loss, or a draw, and these
can be represented by the values +1, -1, or 0, respectively.
A Minimax algorithm can be best defined
as a recursive function that does the
following things:
1. return a value if a terminal state is
found (+1, 0, -1)
2. go through available spots on the
board
3. call the minimax function on each
available spot (recursion)
4. evaluate returning values from function
calls and return the best value
Python Implementation of
TIC-TAC-TOE
Artificial Intelligence- TicTacToe game

Artificial Intelligence- TicTacToe game

  • 1.
    ARTIFICIAL INTELLIGENCE TIC-TAC-TOE Game N am e : M a n i k a k u m a r i R o l l n o . : M T / C S / 1 0 0 0 6 / 1 8 G u i d e d b y : D r. S a n c h i t a P a u l
  • 2.
    Introduction TIC-TAC-TOE Game 1. Twoplayer game – X and O 2. X and O, who take turns mark the spaces in a 3×3 grid. 3. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game.
  • 3.
    Initial State Initially all1 to 9 places of 3x3 grid are empty 1 4 5 3 6 7 8 9 2
  • 4.
    Goal State PLAYER XWIN 3 X’s in a column , row or diagonal PLAYER O WIN 3 O’s in a column , row or diagonal DRAW X O O X X OX O O O X X X X O O X OXO
  • 5.
    Winning Conditions X XX X X X X X X X X X X X X X X X X X X X X X
  • 6.
    State Space Tree 9possibilities X X X X X X X XO O O O 8 possibilities X O X O X O X O X O X X X X X
  • 8.
    MINIMAX Approach Minimax isa recursive algorithm which is used to choose an optimal move for a player assuming that the other player is also playing optimally. Initial state: Initial position of the board/grid . Successor function: I defines what the legal moves from any position Terminal state: I position of the board when the game gets over. Utility function: I function which assigns a numeric value for the outcome of a game. For instance, in tic-tac-toe, the outcome is either a win, a loss, or a draw, and these can be represented by the values +1, -1, or 0, respectively.
  • 9.
    A Minimax algorithmcan be best defined as a recursive function that does the following things: 1. return a value if a terminal state is found (+1, 0, -1) 2. go through available spots on the board 3. call the minimax function on each available spot (recursion) 4. evaluate returning values from function calls and return the best value
  • 11.