Volity

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.

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:

012
345
678

Client to referee RPCs

mark (location)

Request to place a marker in the square denoted by location.

Referee to client RPCs

must_mark (seat)

The named seat must now make a move by placing a mark.

mark (seat, location)

The named seat has placed a mark at the given location.

win (seat, location, location, location)

The named seat has won the game by marking the given locations.

tie ( )

The game is a draw.

Translation tokens

invalid_location

The value given for location was invalid (either less than 0, greater then 8, or not an integer).

volity.not_your_turn

You submitted a game.mark() call to the referee, but it isn't your turn.

already_marked

The player can't mark a requested square, since it's already been marked by someone.