skotz / volcanoes

Prototype for a new board game
4 stars 1 forks source link

Create human-focused view of opening books #58

Open simondorfman opened 3 years ago

simondorfman commented 3 years ago

@skotz could you explain for opening book format please? Is it something like move considered followed by best-counter-move?:

Move: e.g. S40
Best Counter-moves: e.g. S28 N28 etc.)

I want to understand the format and maybe generate a more human-readable view of it so I can try to verify how strong they are. (based on my current understanding of a strong move...)

skotz commented 3 years ago

It's the transcript to get to the position followed by the best move in the resulting position.

The first three lines are meta.

simondorfman commented 3 years ago

I've used this nice node visualization package in R before that might be useful: https://datastorm-open.github.io/visNetwork/ I'll give it a shot sometime.

simondorfman commented 3 years ago

Trying to make sure I understand the file format, I decided to step through some game moves and look for the corresponding moves in the opening book. Using the 600 second book from here: https://github.com/skotz/volcanoes/issues/24#issuecomment-739426971

I'm playing as blue. I go N26 first.

Next, MCTS Opening Book goes N15, then N06.

I found those parts of the file, but I'm wondering what the next best move is for blue, according to the opening book and I don't see a match for N26 N15 G N06 in the file. Why is that?

Screenshots:

N15 move makes sense: 2020-12-07 15_41_50-Greenshot

N06 move makes sense: 2020-12-07 15_45_37-Greenshot

Can't find N26 N15 G N06: 2020-12-07 17_04_47-Greenshot

skotz commented 3 years ago

To limit the number of possible permutations, I consider moves in pairs. Basically there's a Blue opening book and an Orange opening book. Otherwise we'd be looking at roughly 80^5 = 3276800000 possible states, which won't work.

For blue, we just need one book move for the initial position. Then for every 80^2 (roughly) possible opponent moves we decide on our next best two moves. Basically blue's opening book is 1 + 80^2 * 2 (ish) lines.

For orange, for every possible starting blue move we compute the next two moves. Basically orange's opening book is 80*2=160 (ish) lines.

In your example the book opening that orange played was a combo of these two entries:

Blue played N26 which brought the state to N26 so orange looked up the next move here:

image

After orange played N15, the state was N26 N15 G so orange looked up his second move here:

image

simondorfman commented 3 years ago

Ok, I think I'm getting it.

After the three meta lines, I'd describe the file like this:

I'll map out another example to make sure I do get it.

I let the opening book play itself (with just 2 seconds of think time) and got this game result: N07 S28 G N05 N03 G S31 N14 G S03 S04 G N16 S15 G N34 N32 G S35 S17 G N15 S35+ G N33 S17 G N17 S18 G S37

Looking up each move in the opening book:

  1. Blue plays N07: image

  2. Orange plays S28: image

  3. Growth

  4. Orange plays N05: image

  5. Blue plays N03: image

  6. Growth

  7. Blue plays S31: image

  8. Orange plays N14 which doesn't show up in the book because we only go 7 moves deep so far...

simondorfman commented 3 years ago

Instead of creating some sort of node visualization, I was thinking something similar to your "Display Engine Analysis Overlay" might be useful. Something like this: 2020-12-08 01_22_03-Volcanoes 2020-12-08 01_25_23-Volcanoes 2020-12-08 01_29_01-Volcanoes 2020-12-08 01_30_21-Volcanoes 2020-12-08 01_31_13-Volcanoes