Download - Game Tree ( Oyun Ağaçları )
![Page 2: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/2.jpg)
Game playing was one of the first tasks undertaken in AI as soon as computers
became programmable.
![Page 3: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/3.jpg)
Game Systems Rely On
– Search techniques – Heuristic functions– Bounding and pruning techniqiues– Knowledge database on game
![Page 4: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/4.jpg)
Board Games
Tic Tac Toe,Chess,Go....
![Page 5: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/5.jpg)
Why Board Games?
• Two opponents.• Game states are easy to represent.• Not involving chance or hidden.• Search concentrate on one player.
![Page 6: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/6.jpg)
Minimax Method
• Try to find next best move in a game with 2 player .
• The object of a search is to find a path from the starting position to a goal position
• It calculates all possible game states by examining all opposing moves .
• Determine the next move against best play[opponent] .
![Page 7: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/7.jpg)
Minimax Method
• Max tries to maximize its score • Min tries to minimize Max’s score (Min)
Goal: Move to position of highest minimax value
![Page 8: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/8.jpg)
Minimax Method
Minimize Maximum Loss OR
Maximize Minimum Gain
![Page 9: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/9.jpg)
Minimax Search Algorithm1. Generate the whole game tree to leaves2. Apply utility (payoff) function to leaves3. Back-up values from leaves toward the root:* a Max node computes the max of its child values* a Min node computes the Min of its child values4. When value reaches the root: choose maxvalue and the corresponding move.
![Page 10: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/10.jpg)
Evaluation Function
• Each game outcome has a payoff, which we can represent as a number
• By convention, we prefer positive numbers• In some games, the outcome is either a simple
win (+1) or a simple loss (-1)• In some games, you might also tie, or draw (0)
![Page 11: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/11.jpg)
Minimax ( Generate Tree )
![Page 12: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/12.jpg)
Minimax ( Decide Whose Turn )MAX ( Artificial Intelligence )
MIN ( Player )
MAX
MIN
![Page 13: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/13.jpg)
Minimax ( Evaluate Funcions )
12
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
MIN
![Page 14: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/14.jpg)
Minimax ( Evaluate Funcions )
12 7
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
MIN
![Page 15: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/15.jpg)
Minimax ( Evaluate Funcions )
12
12 7
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
MIN
![Page 16: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/16.jpg)
Minimax ( Evaluate Funcions )
12 4
12 7
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
MIN
![Page 17: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/17.jpg)
Minimax ( Evaluate Funcions )
4
12 4
12 7
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
MIN
![Page 18: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/18.jpg)
Minimax ( Evaluate Funcions )
4 3
12
76
34 18 6 15 7 24
1512 5 18 6 7 117 241
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
MIN
![Page 19: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/19.jpg)
Minimax ( Evaluate Funcions )7
4 3
12
76
34 18 6 15 7 24
1512 5 18 6 7 117 241
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
MIN
![Page 20: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/20.jpg)
Minimax ( Evaluate Funcions )7
4 3
12
76
34 18 6 15 7 24
1512 5 18 6 7 117 241
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
MIN
![Page 21: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/21.jpg)
α-β Pruning
• Extension of Minimax Algorithm.
• With the help of α-β Pruning we can reduce the size of game tree so we can get quicker response .
![Page 22: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/22.jpg)
α-β Pruning
If a move is determined worse than another move already examined, then there is no need
for further examination of the node.
![Page 23: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/23.jpg)
α-β Pruning
11 7 5 1 81016 14 2
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
![Page 24: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/24.jpg)
α-β Pruning
7
11 7 5 1 81016 14 2
<7
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
![Page 25: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/25.jpg)
α-β Pruning
7
11 7 5 1 81016 14 2
<7
>7MAX ( Artificial Intelligence )
MIN ( Player )
MAX
![Page 26: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/26.jpg)
α-β Pruning
7
11 7 5 1 81016 14 2
<7
>7
<5
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
![Page 27: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/27.jpg)
α-β Pruning
7
11
5
7 5 81016 2
<7
>7
<5
In 7<x and 5>x interval there can be no x , so we don’t Need to traverse in nodes 14 and 1
114
MAX ( Artificial Intelligence )
MIN ( Player )
MAX
![Page 28: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/28.jpg)
α-β Pruning
7
11 7 5 8
MAX ( Artificial Intelligence )
MIN ( Player )
MAX 1016 2
<7
>7
<5
114
<10
In 7<x and 10>x interval there can be x then continue in nodes 2 and 8
![Page 29: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/29.jpg)
α-β Pruning
7
11 7 5 8
MAX ( Artificial Intelligence )
MIN ( Player )
MAX 1016 2
<7
>7
<5
114
<2
In 7<x and 2>x interval there can be no x , so we don’t Need to traverse in node 8.
![Page 30: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/30.jpg)
α-β Pruning7
7
11 7 5 8
MAX ( Artificial Intelligence )
MIN ( Player )
MAX 1016 2
<7
>7
<5
114
<2
![Page 31: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/31.jpg)
Tic Tac Toe
![Page 32: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/32.jpg)
Tic Tac Toe Game Search
![Page 33: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/33.jpg)
Applying Minimax & α-β Pruning
• Evaluation function of Tic Tac Toe game is just win , lose and draw.
• Computer traverse all nodes until leaf then give every leaf evaluation value. By using minimax method computer select best move.
Win by Computer : 1Win by Opponent : -1Draw : 0
![Page 34: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/34.jpg)
Applying Minimax & α-β Pruning
I assume the game state is like above form. Next move will be X and that will be determined by computer using Minimax Method with α-β Pruning step by step.
![Page 35: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/35.jpg)
-1 0
0
-1 +1
+1
0
0
MAX ( AI )
MAX ( AI )
MIN ( Opponent )
+1
+1
MIN ( Opponent )
-1-1
0
0
α-β Pruning
Computer Choses That Move
![Page 36: Game Tree ( Oyun Ağaçları )](https://reader033.vdocument.in/reader033/viewer/2022061213/547bbfa0b37959532b8b4e5b/html5/thumbnails/36.jpg)
¿ Questions ?