Documentation - TheAbysmalKraken/NatakAPI GitHub Wiki
Getting Game Status
The client should sent a GET request to the Get Game endpoint every few seconds.
Coordinates
Tile Coordinates
Used exclusively for tiles.
Tile Vertex Coordinates
Used for roads, buildings and ports.
Until I create a suitable diagram, I'll try and explain verbally.
Imagine a Cartesian grid overlaying the board, with (0, 0) in the top-left. Every vertex of each tile is represented by an integer set of coordinates on this grid. For example, the tile at (2, 0) will have the coordinates (2, 0), (3, 0) and (4, 0) for its top three vertices. Similarly, the bottom three vertices will have the coordinates (2, 1), (3, 1) and (4, 1). You could think of the tiles as being squished into rectangles to fit in the grid.
Each tile can be split into a set of three coordinates across the top and another set of three coordinates across the bottom. Moving across the top or bottom of a tile will change the x-coordinate, whereas moving from top to bottom or vice versa will change the y-coordinate.
In other words, using the diagram from Tile Coordinates, moving along a vertical line will change the y-coordinate and moving along a diagonal line will change the x-coordinate.
Hopefully this suffices until I make a diagram.
Conversions
These may not be necessary, however you may find them useful.
Tile to surrounding vertices
Given a tile with coordinates (x, y),
let r = 2(x - 1) + y
the surrounding vertices have coordinates (r, y), (r, y + 1), (r + 1, y), (r + 1, y + 1), (r + 2, y), (r + 2, y + 1)
Vertex to surrounding tiles
Given a vertex with coordinates (x, y),
let r = floor(0.5(x - y) + 1)
the surrounding tiles have coordinates (r, y), (r, y - 1)
PLUS a final set of coordinates depending on the following conditions:
{x + y is EVEN, (r - 1, y)}
{x + y is ODD, (r + 1, y - 1)}
Game State
The gameState property of a Game response contains an integer representing the current state of the game (see GameState). This influences which actions can potentially be taken by the current player in the current game state. The actions property is only influenced by the gameState property, so it is possible for an action to be returned as possible but not allowed.
For example, the 'Play a Growth Card' action may be returned despite the player not having any growth cards to play. This specific action can instead be validated by checking the playableGrowthCards property.