0% found this document useful (0 votes)
80 views

Artificial Assignment

Search space of tic tac toe as given condition. Ten chess board position moves. Min Max Algorithm example.

Uploaded by

Ali Raza
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Artificial Assignment

Search space of tic tac toe as given condition. Ten chess board position moves. Min Max Algorithm example.

Uploaded by

Ali Raza
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Name: Ali Raza Reg no:17-CBT-24

Assignment no: 05
Artificial Intelligence [Lab]
1. Search Space of Tic Tac Toe as given condition:
Consider the following state:

Current board state (as shown above):


["X", "X", "O", "-", "X", "-", "O", "-", "-"]
A space that fulfilled is 5.
The search space of tic tac toe is 4!.
Next space states (with “O” as the current player, or turn):
["X", "X", "O", "O", "X", "-", "O", "-", "-"]
["X", "X", "O", "-", "X", "O", "O", "-", "-"]
["X", "X", "O", "-", "X", "-", "O", "O", "-"]
["X", "X", "O", "-", "X", "-", "O", "-", "O"]

2. Ten chess board position moves:


Color is white
Moves
1. Turn white: (g1f3)
Turn black: (f7f5)

2. Turn white: (d2d4)


Turn black: (g8f6)

3. Turn white: (b1c3)


Turn black: (d7d5)
4. Turn white: (c1f4)
Turn black: (b1c6)

5. Turn white: (c3b5)


Turn black: (e7e6)

6. Turn white: (b5c7)


Turn black: (e8f7)
7. Turn white: (f3g5)
Turn black: (f7g8)

8. Turn white: (c7a8)


Turn black: (f8b4)
9. Turn white: (c2c3)
Turn black: (c8d7)

10. Turn white: (a8c7)


Turn black: (e6e5)

3. Min Max Algorithm example:


Min Max Algorithm:
1. 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.

2. It is used in games such as tic-tac-toe, go, chess, Isola, checkers, and many other
two-player games.
3. Such games are called games of perfect information because it is possible to see
all the possible moves of a particular game.

4. There can be two-player games which are not of perfect information such as
Scrabble because the opponent’s move cannot be predicted.

5. It is similar to how we think when we play a game: “if I make this move, then my
opponent can only make only these moves,” and so on.

6. Minimax is called so because it helps in minimizing the loss when the other player
chooses the strategy having the maximum loss.
Min Max Algorithm example:
1. This common pruning function is used to considerably decrease the min-
max search space.
2. It essentially keeps track of the worst and best moves for each player so
far, and using those can completely avoid searching branches which are
guaranteed to yield worse results.
3. Using this pruning will return the same exact moves as using min-max
(i.e. there is no loss of accuracy).
4. Ideally, it can double the depth of the search tree without increasing
search time.
5. To get close to this optimum, the available moves at each branch should
be appropriately sorted.
6. The sorting is done by the looking at the scores of each possible move,
looking only 1 ply ahead.
7. The intuitive sort would be to arrange them from best to worst, but
that's not always best.
8. Most moves in chess end up being ones with small gains and losses (ones
that improve position, not necessarily capturing pieces), so it makes
sense to order the "stand pat" moves first. So, the sorting is based on
the absolute value of
9. the move scores (with the smaller ones coming first).
10. The average branching factor for min-max in chess is about 35, but with
the alpha-beta pruning and sorting, the program achieves a branching
factor of around 25.
Terminology:
Game Tree: It is a structure in the form of a tree consisting of all the possible
moves which allow you to move from a state of the game to the next state.
A game can be defined as a search problem with the following components:
Initial state: It comprises the position of the board and showing whose move it
is.
Successor function: It defines what the legal moves a player can make are.
Terminal state: It is the position of the board when the game gets over.
Utility function: It is a function which assigns a numeric value for the outcome
of a game. For instance, in chess or 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. There are games that have a much larger range of possible
outcomes; for instance, the utilities in backgammon varies from +192 to -192.
A utility function can also be called a payoff function.

You might also like