Theory of Computer Games: Concluding Remarks
Tsan-sheng Hsu
tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu
1
Theory of Computer Games: Concluding Remarks Tsan-sheng Hsu - - PowerPoint PPT Presentation
Theory of Computer Games: Concluding Remarks Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Abstract Practical issues. The open book. The endgame database. Smart usage of resources. Time
tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu
1
⊲ Time ⊲ Memory ⊲ Coding efforts ⊲ Debugging efforts
⊲ Software tools ⊲ Fine tuning
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Use off-line computation to find out the value of a position for a given depth that cannot be computed online during a game due to resource constraints.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ win: the number of games reaching this position and then wins. ⊲ loss: the number of games reaching this position and then loss. ⊲ draw: the number of games reaching this position and then draw.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
W1,D1,L1 W2,D2,L2 w3,D3,L3
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Dark chess: adjacent attack of the opponent’s Cannon. [Chen and Hsu 2013]
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ KCPGGMMKGGMM ( vs. ): the database consisting of RED Cannon and Pawn, and Guards and Ministers from both sides.
⊲ What is the best possible outcome, i.e. win/loss/draw, that the player can achieve starting from this position? ⊲ What is a strategy to achieve the best possible outcome?
⊲ win/loss/draw; DTC; DTZ; DTR.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Each vertex is called a position. ⊲ May want to remove symmetry positions.
⊲ Bipartite. ⊲ Huge number of vertices and edges for non-trivial endgames. ⊲ Example: KCPGGMMKGGMM has 1.5∗1010 positions and about 3.2∗ 1011 edges.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
... OR search ... AND search ... ... ... ... ...
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Watch out the and-or rules.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
terminal positions
backward propagation TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ so called “distance-to-capture” (DTC); ⊲ the traditional metric is “distance-to-mate” (DTM).
⊲ KCKGGMM ⊲ KPKGGMM ⊲ KCPKGMM, KCPKGGM
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ a stable position is a pendant in the current state graph; ⊲ a propagated position is removed from the sate graph; ⊲ no vertex in a cycle can be a pendant.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Threaten the opponent and fall into a repeated sequence is illegal. ⊲ You can threaten the opponent only if you have attacking pieces. ⊲ The stronger side does not need to threaten an opponent without at- tacking pieces. ⊲ All positions in cycles are draws.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Perfect information for roughly 7.75 ∗ 109 positions per endgame. ⊲ 1.5 – 3 ∗1012 bytes for all 3- to 6-piece endgames.
⊲ Using parallel machines. ⊲ Win/loss/draw.
⊲ Currently the largest endgame database of any games using a sequential machine. ⊲ Win/loss/draw. ⊲ Solved in the year 2007 with a total endgame size of 3.9 ∗ 1013.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ About 4 ∗ 106 positions; Perfect information.
⊲ About 2 ∗ 109 positions; Perfect information.
⊲ About 8.8 ∗ 109 positions; 2.6 ∗ 10−5 seconds per position; Perfect in- formation. ⊲ The largest single endgame database and the largest collection reported.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Limitation: 1 bit per position.
⊲ Using combinatorial properties to do the partition.
⊲ Disk-based algorithms.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ It is hard to predict the total number of moves in a game in advance. However, you can have some rough ideas.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ CPU time #include <time.h> ... double start = (double) clock(); ... double end = (double) clock(); double cpu_time_in_seconds = (end - start) / (double) CLOCK_PER_SEC; ⊲ Wall clock time #include <time.h> ... struct timespec start, end; clock_gettime(CLOCK_REALTIME, &start); ... clock_gettime(CLOCK_REALTIME, &end); double wall_clock_in_seconds = (double)((end.tv_sec+end.tv_nsec*1e-9) - (double)(start.tv_sec+start.tv_nsec*1e-9));
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ May be larger or smaller than the actual time spent due to time con- trolling schemes used.
⊲ time: Spend T
N time for each ply
⊲ depth: Search up to to depth D for each ply where D is estimated using
T N time before the tournament.
⊲ Let ti be the time you have spent at the ith ply, for i < j. ⊲ Plan to spend
T −j−1 i=1 ti N−j+1
time for the jth ply.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ open game: knowledge is needed more than depth; however, need some depth, say 4. ⊲ middle game: deeper depth is needed ⊲ end game: depth is on demand
⊲ When there is only one possible move, do not think. ⊲ When the score is stable, cut short the time to spend. ⊲ When the situation is dangerous, spend more time.
⊲ When he is going to be out of time, do not let him have a chance to use your time in doing pondering.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ ti: average time, during the last few plys, spent in searching depth-i ⊲ prediction: ti+1 ∼ (ti ·
ti ti−1), i > 1
⊲ if the remaining time for this ply is less than the predicted time, then do not initiate a new depth
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ How interrupt is handled? ⊲ Polling every now and then or triggered by events?
⊲ You choose to play m1, and then it’s the opponent’s turn to think. ⊲ In pondering, you assume (guess) the opponent plays m2. ⊲ Then you continue to think at the same time your opponent thinks as if he has played m2.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ When the amount of your time left is low, speed up the search. ⊲ When the amount of your opponent’s time is low and you are more than his, spend less time and wait for his over time.
⊲ Need to set a minimum searching depth. ⊲ Need to set a maximum searching depth to avoid buffer overflow.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ A large number of positions are not visited too often.
⊲ You need to wait for its termination. ⊲ Synchronization takes resources.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Using a 2-D array to store the board and find everything by scanning the board is time consuming. ⊲ Better strategy: have a list of pieces that are still alive and a board at the same time with proper co-referencing.
⊲ Evaluation function: knowledge. ⊲ Main search algorithm: iterative deepening. ⊲ Enhancements: transposition tables, Quiescent search and possible oth- ers.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Object code may not be stable using aggressive optimization flags.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Build a working version using a minimum effort. ⊲ Add features one at a time. ⊲ Always keep a working version in the process.
⊲ A new feature may cause an old function to have new bugs.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ We also assume each copy alternatives in playing first.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
i ) = x
i=1 Xi.
⊲ The mean of X[n], E(X[n]), is 0. ⊲ The standard deviation of X[n], σn, is x√n
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Data source: 63,548 games played among masters recorded at www.dpxq.com. ⊲ This means the first player has a better chance of winning.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
P r(|X[n]| ≤ s) s = 0 s = 1 s = 2 s = 3 s = 4 s = 5 s = 6
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
P r(|X[n]| ≤ s) s = 7 s = 8 s = 9 s = 10 s = 11 s = 12 s = 13
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
P r(|X[n]| ≤ s) s = 14 s = 15 s = 16 s = 17 s = 18 s = 19 s = 20
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ Then this result is meaningful, that is a program is better than the
⊲ Then this result is not very meaningful, because it happens with a high probability of 0.95.
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
⊲ You can only solve a game once!
⊲ You can learn lots of knowledge.
⊲ Understand the fundamental properties such as how rules and boundary affect the game behavior and use that to improve our life. ⊲ How fun is a game and why?
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c
TCG: Concluding remarks, 20200102, Tsan-sheng Hsu c