Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms & Data Structures for Games

Similar presentations


Presentation on theme: "Algorithms & Data Structures for Games"— Presentation transcript:

1 Algorithms & Data Structures for Games
Minor Games Programming Algorithms & Data Structures for Games Lecture 5

2 Algorithms and Data Structures
Feedback previous lectures Theory: Boards Game Algorithms Jan Verhoeven

3 Theory: Some Board Game Algorithms
Static Evaluation function Alpha-beta pruning Move ordering Iterative deepening Killer heuristic Transposition table Zobrist hashing

4 Static Evaluation function
Not done at leave nodes! But what is a stable situation? Horizon effect?

5 Alpha-beta pruning Greatest effect when the moves are ordered! Best move first ….  Move ordering

6 Move ordering Best moves first (more pruning!):
Defend against direct winning opponent’s moves (“mate”-moves) Capture moves Killer moves (see later)

7 Iterative deepening -1-
Iterative deepening means repeatedly calling a fixed depth search routine with increasing depth until a time limit is exceeded or maximum search depth has been reached. .html

8 Iterative deepening -2-
The advantage of doing this is that you do not have to choose a search depth in advance; you can always use the result of the last completed search.

9 Iterative deepening -3-
Also because many position evaluations and best moves are stored in the transposition table, the deeper search trees can have a much better move ordering than when starting immediately searching at a deep level.

10 Killer heuristic The killer heuristic is used to improve the move ordering. The idea is that a good move in one branch of the tree is also good at another branch at the same depth. For this purpose at each ply we maintain one or two killer moves that are searched before other moves are searched. A successful cutoff by a non-killer move overwrites one of the killer moves for that ply.

11 Transposition table The transposition table is a hashing scheme to detect positions in different branches of the search tree that are identical.

12 Zobrist hashing A smart way to construct hash keys for a transposition table, depending on the board position.

13 Transposition Tables Presentation
See and study blackboard: Transposition Tables.ppt And if you are really interested:

14 Exercise: -give the transposition table (size=8) - randoms are in octal
1 0123 0456 2 0172 0263 3 0314 0557 4 0662 0527 5 0116 0374 6 0252 0153 7 0771 0722 8 0742 0275 9 0337 0142 Situation 1: Situation 2:

15 Extra Presentation, please read and don’t study …
On blackboard: Game programming workshop Japan By prof.dr. Jaap van den Herik

16 Homework This Chapter 10.5.2 Articles, Presentations and the Internet
Homework, study/read: This Chapter Articles, Presentations and the Internet

17 Practice (next THURSDAY !!!)
Practice, be prepared for: Implement a Transposition Table class using Zobrist hashing for a given board game. Make a test program to demonstrate this class.


Download ppt "Algorithms & Data Structures for Games"

Similar presentations


Ads by Google