Reversing Stones Programmer's Quick Reference

Understanding The Gamestate

Your calculateMove() function will be passed the current state of the game, the 'gamestate'. The gamestate is a python dictionary containing the following keys:

  • Board - A list of lists representing each row on the board.
  • Role - Whether you are the Dark or Light player. The Dark player moves first.
  • PossibleMoves - A list of lists containing every valid move that can be made at this point in the game.
  • IsMover - A Boolean value indicating whether it is your turn to move. It will always be true when in the calculateMove() function. (Delve deeper into the code if you want to do some processing during your opponent's turn.)
  • ResponseDeadline - The epoch time, in milliseconds, that a successful move has to be sent and received by to prevent you from timing out.
  • GameStatus - A string that will have value "RUNNING" if the game is in progress or a reason the game has ended otherwise.
  • GameId - An integer representing the unique game id for the current game.
  • OpponentId - A string containing the name of your opponent.

Understanding The Boards

The strings in your board can contain the following values:

  • -1 - A cell that has not yet had a stone laid on it.
  • 0 - A cell that has a Dark coloured stone on it.
  • 1 - A cell that has a Light coloured stone on it.

Making A Valid Move

Helper Functions


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License