Inputs for neural networks for the board games

jacek
228 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Oware abapa

This one is simple. There are 12 pits and 2 scores. I use pure one-hots in this game, even for scores. There are exactly 14 active inputs ('ones') out of possible 14x26=364 inputs, for each position. Each pit can have 0 up to 25 seeds (any more I cap at 25) and each score can be from 0 to 25 (again capping at 25). I could probably use scalar values for scores, as the more the merrier, but for simplicity they are one-hoted as well. When it is second player to move, I rotate the pits and switch scores, so the network always thinks it is first player. Because for most moves there are many chages in position, I don't use partial updates here, I just evaluate each position fully.

One-hots in oware work well, because they distinguish empty pits, 2 and 3 seeds pits from the others, so the network automatically gets to know something special about them. I know a guy who used 14 scalar inputs, but when he switched to one-hots his bot achieved better play level at 10x less training games.

oware

Indexes per pits (last 2 are scores) in the image above are: { 1, 1, 1, 16, 2, 4, 1, 1, 5, 0, 2, 3, 5, 6 }

As index inputs for the net: { 1, 27, 53, 94, 106, 134, 157, 183, 213, 234, 262, 289, 317, 344 }. You calculate the index inputs by 26 * pit position + index. This is what I will mean when I write about indexes (per pit, per square...) in other games.

As raw inputs: { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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