Tic-Tac-Toe
This document describes Version 2.1 of the Tic Tac Toe API. It largely serves as part of the Volity game development tutorial.
Two players, in seats labeled X and O, take turns marking squares in a three-by-three grid, trying to be the first to get three of their markers in a straight line. X goes first.
This ruleset features no setup-phase RPCs. The only set-up decision the players must make is who gets to go first, and this is simply a matter of seating.
Seat IDs
This being a strictly two-player game, both of these seats are required.
xo
RPCs
In all of these calls, location is an integer between 0 and 8, corresponding to one of the squares on the Tic-Tac-Toe grid:
| 0 | 1 | 2 |
| 3 | 4 | 5 |
| 6 | 7 | 8 |
Client to referee RPCs
Request to place a marker in the square denoted by location.
Referee to client RPCs
The named seat must now make a move by placing a mark.
The named seat has placed a mark at the given location.
The named seat has won the game by marking the given locations.
The game is a draw.
Translation tokens
The value given for location was invalid (either less than 0, greater then 8, or not an integer).
You submitted a game.mark() call to the referee, but it isn't your turn.
The player can't mark a requested square, since it's already been marked by someone.