calcitem / chaosclock

C++ implementation of the "Chaos Clock" game invented by ejsoon, related information: https://quanquan.space/viewtopic.php?t=852
https://ejsoon.win/chaosclock/
1 stars 1 forks source link

测试用例更新 #8

Open calcitem opened 1 year ago

calcitem commented 1 year ago

对于 https://ejsoon.win/chaosclock/4/ , 各个局面如下:

4,3,11,0,5,6,0,0,0,2,0,0;1;12 
4,3,11,0,5,6,12,0,0,2,0,0;0;11
4,3,7,11,5,6,12,0,0,2,0,0;1;6
4,3,7,11,5,10,12,0,0,2,0,0;0;7
4,3,1,11,5,10,12,7,0,2,0,0;1;4
8,3,1,11,5,10,12,7,4,2,0,0;0;3
8,6,1,11,5,10,12,7,4,2,3,0;1;5
8,6,1,11,9,10,12,7,4,2,3,5

4 己贏 3 共贏 2 同輸 1 己輸 0 無果

目前使用

4,3,7,11,5,10,12,0,0,2,0,0;0;7

其输出结果为:

roll_sum:679988
max_depth:20
result_sum:370647

Stage 1 took 1000 ms
board: 4, 3, 7, 11, 5, 10, 12, 0, 0, 2, 0, 0,
depth:0
player: 0
value:3
available move:6
  0: 2 (value: 4)
  1: 10 (value: 3)
  2: 11 (value: 4)
  3: 12 (value: 3)
  4: 6 (value: 3)
  5: 8 (value: 4)
Stage 2 took 0 ms

为用例。随着优化地进行,用例需要不断更新。

現在是第五層,那麼第一層的用時大概會是12111091250。

如果往上一層,是否已經可以在30s以內?

ejmoog commented 1 year ago

我的電腦的運行結果:

roll_sum:679988 max_depth:20 result_sum:952782

Stage 1 took 11581 ms board: 4, 3, 7, 11, 5, 10, 12, 0, 0, 2, 0, 0, depth:0 player: 0 value:3 available move:6 0: 2 (value: 4) 1: 10 (value: 3) 2: 11 (value: 4) 3: 12 (value: 3) 4: 6 (value: 3) 5: 8 (value: 4) Stage 2 took 0 ms

因為CPU還是奔騰系列。

calcitem commented 1 year ago

result_sum 是表示?比我的大好多。

ejmoog commented 1 year ago

result_sum是指有評分結果的局面的數量,即1到4分的局面數量。

你可以再跑一次看看?是否仍不一樣?我用的是最新的代碼。

(email有亂碼…)

ejmoog commented 1 year ago

好像即便機器性能有差,但是result_sum應該仍是一樣的?

不過result_sum不應該大於rollsum。

所以可能存在某種bug…

calcitem commented 1 year ago

确实最新版本 result_sum 大很多,数字和你的一样。我后面看看是什么修改引入了问题。

calcitem commented 1 year ago

优化后可能引入问题,因此需要做好回归测试才行。当前我用的测试用例只有一个,覆盖不全。因此,需要多增加几个,要支持从文件读取多个用例,逐一计算后,和存储在其他文件中的预期输出结果自动比较,关键的数据都要比,需要完全一致。最后输出比较结果。

calcitem commented 1 year ago

基于 https://github.com/calcitem/chaosclock/commit/e827d0dd482fa9c954b339b52d93b432d95b9df4 在 VC Relase 模式下得到如下标准用例:

8,6,1,11,9,10,12,7,4,2,3,5

board: 8, 6, 1, 11, 9, 10, 12, 7, 4, 2, 3, 5,
player: 1
last_move: 0

roll_sum:3093466
max_depth:36
result_sum:436087

movelist:
roll->value: 3 ; player: 1 ; lastmove: 0 ; maxdeep: 36
 ; board: 8, 6, 1, 11, 9, 10, 12, 7, 4, 2, 3, 5,
this_depth: 0 ; available move:12
  0: ->value: 4 ; player: 0 ; lastmove: 1 ; maxdeep: 29
  1: ->value: 4 ; player: 0 ; lastmove: 2 ; maxdeep: 28
  2: ->value: 4 ; player: 0 ; lastmove: 3 ; maxdeep: 34
  3: ->value: 4 ; player: 0 ; lastmove: 4 ; maxdeep: 36
  4: ->value: 3 ; player: 0 ; lastmove: 5 ; maxdeep: 25
  5: ->value: 4 ; player: 0 ; lastmove: 6 ; maxdeep: 21
  6: ->value: 4 ; player: 0 ; lastmove: 7 ; maxdeep: 20
  7: ->value: 4 ; player: 0 ; lastmove: 8 ; maxdeep: 32
  8: ->value: 4 ; player: 0 ; lastmove: 9 ; maxdeep: 32
  9: ->value: 4 ; player: 0 ; lastmove: 10 ; maxdeep: 29
  10: ->value: 4 ; player: 0 ; lastmove: 11 ; maxdeep: 17
  11: ->value: 4 ; player: 0 ; lastmove: 12 ; maxdeep: 29

2,8,11,9,4,12,10,6,5,7,1,3;1;0

board: 2, 8, 11, 9, 4, 12, 10, 6, 5, 7, 1, 3,
player: 1
last_move: 0

roll_sum:6432834
max_depth:48
result_sum:632006

movelist:
roll->value: 3 ; player: 1 ; lastmove: 0 ; maxdeep: 48
 ; board: 2, 8, 11, 9, 4, 12, 10, 6, 5, 7, 1, 3,
this_depth: 0 ; available move:12
  0: ->value: 4 ; player: 0 ; lastmove: 1 ; maxdeep: 48
  1: ->value: 4 ; player: 0 ; lastmove: 2 ; maxdeep: 26
  2: ->value: 4 ; player: 0 ; lastmove: 3 ; maxdeep: 16
  3: ->value: 4 ; player: 0 ; lastmove: 4 ; maxdeep: 23
  4: ->value: 4 ; player: 0 ; lastmove: 5 ; maxdeep: 29
  5: ->value: 3 ; player: 0 ; lastmove: 6 ; maxdeep: 28
  6: ->value: 4 ; player: 0 ; lastmove: 7 ; maxdeep: 35
  7: ->value: 4 ; player: 0 ; lastmove: 8 ; maxdeep: 23
  8: ->value: 4 ; player: 0 ; lastmove: 9 ; maxdeep: 9
  9: ->value: 4 ; player: 0 ; lastmove: 10 ; maxdeep: 31
  10: ->value: 4 ; player: 0 ; lastmove: 11 ; maxdeep: 26
  11: ->value: 4 ; player: 0 ; lastmove: 12 ; maxdeep: 29

4,3,7,11,5,10,12,0,0,2,0,0;1;7

board: 4, 3, 7, 11, 5, 10, 12, 0, 0, 2, 0, 0,
player: 1
last_move: 7

roll_sum:14910
max_depth:19
result_sum:3750

movelist:
roll->value: 3 ; player: 1 ; lastmove: 7 ; maxdeep: 19
 ; board: 4, 3, 7, 11, 5, 10, 12, 0, 0, 2, 0, 0,
this_depth: 0 ; available move:6
  0: ->value: 3 ; player: 0 ; lastmove: 6 ; maxdeep: 17
  1: ->value: 4 ; player: 0 ; lastmove: 8 ; maxdeep: 19
  2: ->value: 4 ; player: 0 ; lastmove: 2 ; maxdeep: 18
  3: ->value: 3 ; player: 0 ; lastmove: 10 ; maxdeep: 11
  4: ->value: 4 ; player: 0 ; lastmove: 11 ; maxdeep: 12
  5: ->value: 3 ; player: 0 ; lastmove: 12 ; maxdeep: 10

9,10,8,1,4,7,11,6,5,3,12,2

第2步

board: 9, 10, 8, 1, 4, 7, 11, 6, 5, 3, 12, 2,
player: 1
last_move: 0

roll_sum:6335201
max_depth:45
result_sum:654886

movelist:
roll->value: 1 ; player: 1 ; lastmove: 0 ; maxdeep: 45
 ; board: 9, 10, 8, 1, 4, 7, 11, 6, 5, 3, 12, 2,
this_depth: 0 ; available move:12
  0: ->value: 4 ; player: 0 ; lastmove: 1 ; maxdeep: 45
  1: ->value: 4 ; player: 0 ; lastmove: 2 ; maxdeep: 24
  2: ->value: 4 ; player: 0 ; lastmove: 3 ; maxdeep: 38
  3: ->value: 4 ; player: 0 ; lastmove: 4 ; maxdeep: 36
  4: ->value: 4 ; player: 0 ; lastmove: 5 ; maxdeep: 40
  5: ->value: 4 ; player: 0 ; lastmove: 6 ; maxdeep: 40
  6: ->value: 4 ; player: 0 ; lastmove: 7 ; maxdeep: 37
  7: ->value: 4 ; player: 0 ; lastmove: 8 ; maxdeep: 36
  8: ->value: 4 ; player: 0 ; lastmove: 9 ; maxdeep: 41
  9: ->value: 4 ; player: 0 ; lastmove: 10 ; maxdeep: 27
  10: ->value: 4 ; player: 0 ; lastmove: 11 ; maxdeep: 24
  11: ->value: 4 ; player: 0 ; lastmove: 12 ; maxdeep: 36

select one option: 0
movelist: 1
roll->value: 4 ; player: 0 ; lastmove: 1 ; maxdeep: 45
 ; board: 9, 10, 8, 0, 1, 7, 11, 6, 5, 3, 12, 2,
this_depth: 1 ; available move:2
  0: ->value: 3 ; player: 1 ; lastmove: 2 ; maxdeep: 32
  1: ->value: 1 ; player: 1 ; lastmove: 3 ; maxdeep: 45

select one option:
calcitem commented 1 year ago

问题:当前 master 分支最新版本,和上帖用例相比,每个可选着法的 maxdeep 不一定相同,roll_sum、max_depth、result_sum 未必相同。是否说明存在隐患?(每个选项的 value 值则是相同的)