-
Notifications
You must be signed in to change notification settings - Fork 3
Performance Notes
Depth 4 AI Attackable Moves Caching (With Moves Caching):
- improves performance >2x with 10x memory cost
aiPlayerSmart := ai.NewAIPlayer(color.Black)
aiPlayerSmart.Algorithm = ai.AlgorithmAlphaBetaWithMemory
aiPlayerSmart.MaxSearchDepth = 3
aiPlayerDumb := ai.NewAIPlayer(color.White)
aiPlayerDumb.Algorithm = ai.AlgorithmRandom
-
w attackable move cache, checkmate enemy, checkmate self
Alloc = 6491 MiB | NumGC = 29
Average move time:
White: 0.002748s
Black: 3.186323s
Game state: Black Win
Played 32 moves in 103912 ms.
Good AI AI (AlphaBetaMemory,depth:3 - Black) Evaluation 2147483647.
Bad AI AI (Random,depth:4 - White) Evaluation -2147483648. -
w attackable move cache, checkmate enemy
Alloc = 3129 MiB | NumGC = 29
Average move time:
White: 0.002815s
Black: 1.911539s
Game state: Black Win
Played 32 moves in 61268 ms.
Good AI AI (AlphaBetaMemory,depth:3 - Black) Evaluation 2147483647.
Bad AI AI (Random,depth:4 - White) Evaluation -29990. -
w attackable move cache, no checkmate
Alloc = 411 MiB | NumGC = 50
Average move time:
White: 0.002743s
Black: 0.561168s
Game state: Black Win
Played 42 moves in 23701 ms.
Good AI AI (AlphaBetaMemory,depth:3 - Black) Evaluation 32470.
Bad AI AI (Random,depth:4 - White) Evaluation -32470. -
w attackable move cache, no checkmate no check
Alloc = 458 MiB | NumGC = 45
Average move time:
White: 0.002730s
Black: 0.327729s
Game state: Black Win
Played 44 moves in 14647 ms.
Good AI AI (AlphaBetaMemory,depth:3 - Black) Evaluation 24150.
Bad AI AI (Random,depth:4 - White) Evaluation -24150. -
wout attackable move cache, checkmate enemy, checkmate self
Alloc = 409 MiB | NumGC = 279
Average move time:
White: 0.002808s
Black: 4.058911s
Game state: Black Win
Played 32 moves in 129993 ms.
Good AI AI (AlphaBetaMemory,depth:3 - Black) Evaluation 2147483647.
Bad AI AI (Random,depth:4 - White) Evaluation -2147483648. -
wout attackable move cache, checkmate enemy
Alloc = 366 MiB | NumGC = 183
Average move time:
White: 0.002690s
Black: 2.157748s
Game state: Black Win
Played 32 moves in 69139 ms.
Good AI AI (AlphaBetaMemory,depth:3 - Black) Evaluation 2147483647.
Bad AI AI (Random,depth:4 - White) Evaluation -29990.
-
>Depth 3 wout attackable move cache, no checkmate
Alloc = 282 MiB | NumGC = 137
Average move time:
White: 0.002644s
Black: 0.647684s
Game state: Black Win
Played 42 moves in 27369 ms.
Good AI AI (AlphaBetaMemory,depth:3 - Black) Evaluation 32470.
Bad AI AI (Random,depth:4 - White) Evaluation -32470. -
!Depth 3 wout attackable move cache, no checkmate no check
Alloc = 214 MiB | NumGC = 114
Average move time:
White: 0.002592s
Black: 0.375460s
Game state: Black Win
Played 44 moves in 16644 ms.
Good AI AI (AlphaBetaMemory,depth:3 - Black) Evaluation 24150.
Bad AI AI (Random,depth:4 - White) Evaluation -24150. -
>Depth 4, wout attackable move cache, no checkmate yes check
Alloc = 2234 MiB | NumGC = 215
Average move time:
White: 0.002700s
Black: 9.369547s
Game state: Black Win
Played 30 moves in 281722 ms.
Good AI AI (AlphaBetaMemory,depth:4 - Black) Evaluation 24350.
Bad AI AI (Random,depth:4 - White) Evaluation -24350. -
!Depth 4, wout attackable move cache, no checkmate no check
Alloc = 2233 MiB | NumGC = 194
Average move time:
White: 0.002637s
Black: 8.451256s
Game state: Black Win
Played 30 moves in 254038 ms.
Good AI AI (AlphaBetaMemory,depth:4 - Black) Evaluation 25350.
Bad AI AI (Random,depth:4 - White) Evaluation -25350. -
>Depth 5, wout attackable move cache, no checkmate yes check
OOM not practical -
!Depth 5, wout attackable move cache, no checkmate no check
Alloc = 10332 MiB | NumGC = 223
Average move time:
White: 0.002962s
Black: 52.211743s
Game state: Black Win
Played 24 moves in 1254272 ms.
Good AI AI (AlphaBetaMemory,depth:5 - Black) Evaluation 19340.
Bad AI AI (Random,depth:4 - White) Evaluation -19340. -
&Depth 6, NO CACHING, yes opponent checkmate yes check
OOM not practical -
&Depth 6, NO CACHING, no opponent checkmate no check
OOM not practical -
Evaluate benchmark