I am currently doing my thesis project by creating an Imitation Learning (IL) agent that learns to play the board game Hive, which lacks a traditional 2D board. Pieces are placed relative to one another along their hexagonal edges, and my state space representation for the game currently is a set of Cartesian Co-ordinates for a piece in play, along with an enum representing the piece (i.e., 'white Beetle 1' etc.) - where the first piece in play starts at (0, 0)
. It is also worth noting that the game isn't merely 2D either - pieces may, in some cases, stack on top of one another.
How do I create an input, and output state for this model in PyTorch given there is no fixed board state in this game? I wish to input game states as an array, where each move is a new input - in essence like a timeseries.
In the paper 'AZ-Hive case study' (found here), the game is represented by a 24x24 tile grid, with pieces represented as integers, with integers being added to one another to represent a stack of pieces. Is there perhaps a quick fix here by transposing my Cartesian co-ordinates onto a Numpy array of 28x28 zeroes and the enumerations for each piece as their value?
Having asked chatGPT, it suggested an input dict of fixed length such as the following snippet as an example:
{
"player_turn": "black",
"pieces": [
{
"type": "ant",
"position": (0, 0),
"connections": [(0, 1), (1, 0)]
},
{
"type": "grasshopper",
"position": (0, 1),
"connections": [(0, 0), (0, 2), (1, 1)]
},
{
"type": "beetle",
"position": (0, 2),
"connections": [(0, 1), (1, 2)]
}
]
}
I am, however, unsure of this input as it relies on far too many dimensions for me to get my head around as an input.
I wish to create a PyTorch model that can capture some of the intricacies and strategies of the game, whilst not having to rewrite my current game representation entirely, as my move validator etc. is extensive. Any feedback in input and output of this model is greatly appreciated!