danzel / PatchworkSim

Simulation of the board game Patchwork for AI exploration
2 stars 0 forks source link

Victories against AI #44

Open danzel opened 6 years ago

danzel commented 6 years ago

Seed 4 vs AB(13) https://gist.github.com/danzel/873e2b6478b8f3083183156e1c666588 MCTS picks a different move in turn 26 (At 26 there are only 7 turns left, so AB should be completely solving the game) Human moves: 0 0 z z 1 2 1 1 1 1 0 0 1 [differs from here] 2 2 0 2 2

danzel commented 6 years ago

Rerunning it got a different answer, investigating it looks like InsertionSort in AB might be broken. Logging the Can purchase piece checks, then the values of the possible moves evaluated:

CPP? 0 True
CPP? 1 True
CPP? 2 True
2: 2147483647
-1: -2147483648
30) Player 1 purchased 5x1 line

Where is 0 and 1 🤔

This bug happens earlier at turn 22 also.

CPP? 0 True
CPP? 1 True
CPP? 2 True
2: 2147483647
-1: 25
23) Player 1 purchased u
danzel commented 6 years ago

That bug is actually just me being an idiot, we stop evaluating when we have a path that leads to a definite win. (continue statement in the AlphaBeta loop)

danzel commented 6 years ago

However, in that log the AI purchases the Y piece in turn 30, but when running it again it purchases the 5x1 line...

Think we need AlphaBeta with real placement.