Download presentation

Presentation is loading. Please wait.

Published byPaulina Wiggins Modified about 1 year ago

1
Advanced Game Play Prepare for 4x4x4 tic-tac-toe

2
Checkers is Solved! Checkers has approximately 500 billion positions Jonathan Schaeffer ▫Retrograde analysis All combinations of 1-10 pieces (endgame positions) ▫Standard openings (first ~10 moves) ▫“middle game” solved using search with heuristics

3
Transposition Tables - Hash Tables After a position is analyzed, an entry is made in a hash table so that if that position is encountered again, its value can be immediately reported Often the limiting factor is the size of the available hash table The same moves made in a different order will often generate the same positions Hash tables should usually contain the position, the evaluation, and the level of that evaluation

4
Zobrist Hashing Source: Zobrist Hashing was developed specifically for games in which game states differ slightly from move to move. Utilizes properties of XOR (r i uniform random) ▫r i XOR (r j XOR r k ) = (r i XOR r j ) XOR r k ▫r i XOR r j = r j XOR r i ▫r i XOR r i = 0 ▫If (s i = r 1 XOR r 2 XOR r 3 XOR r 4 … XOR r i ) then s i is a random sequence ▫{s i } is uniformly distributed

5
Step 1 – Create a bit string for every possible combination of piece and square Example – tic-tac-toe (standard game) ▫There are nine squares ▫Each square can be in one of three states Empty Contain an “X” Contain an “O” ▫There are 9*3 = 27 piece-square combinations ▫Create 27 bit strings, one for each piece-square combination.

6
Step 1 (continued) BitString squarePiece[N_Squares][N_Pieces]; For(int square=0;square

7
Step 2 Initialize the board to empty ▫zorbristHash = 0; ▫For every square on the board zorbristHash = zorbristHash XOR squarePiece[square][EMPTY_SQUARE];

8
Step 3 Each time a player makes a move ▫Remove the old state for that square zorbristHash = zorbristHash XOR squarePiece[square][currentOccupant]; ▫Add the new state for that square zorbristHash = zorbristHash XOR squarePiece[square][newOccupant]; ▫Example – x moves in the center zorbristHash =zorbristHash XOR squarePiece[4][Empty]; zorbristHash = zorbristHash XOR squarePiece[4][X];

9
4x4x4 Tic-Tac-Toe 64 Squares 3 states/Square 3*64 unique bit strings

10
Symmetry in simple tic-tac-toe 4 rotations 2 reflection

11
4x4x4 tic-tac-toe Number of positions ▫64 squares Each square can be empty, have a white stone, or a black stone 3 64 is approximately ! Lots of symmetry – but only the 4 rotations are obvious.

12
Exploiting Equivalence Convert all positions to a “normalized” form For example: ▫When a position is encountered Find the equivalent position with the smallest hash value All equivalent positions use the same representation

13
Killer Move Heuristic Moves that are strong in one position tend to be strong in other positions too. ▫Remember the moves that are strong at each depth ▫Try these moves first, as they are likely to cause alpha-beta pruning

14
Null-move Heuristic Used in alpha-beta search ▫Player to move “forfeits” a move and continues search to a shallow depth to see if the position is “so good” that alpha-beta will still cut it off. ▫Extra time is spent doing the shallow search if it does not provide a cut-off. ▫When it does provide a cut-off, the branch can be abandoned without deeper search.

15
Aspiration Window Search Alpha-beta search with a guess at the range of the value of the position ▫Make the range as narrow as you can with a high probability that the true value is inside that range. ▫Typically, center the range on the expected value ▫If the returned value is within the range The value is the same as what you would have achieved with normal alpha-beta, but there was probably better pruning ▫If the value is at or above beta The position is better than expected ▫If the value is at or below alpha We were too optimistic – another search is needed.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google