Skip to content

Ultimate TTT Server: Protocol

Alejandro U. Alvarez edited this page Jul 25, 2018 · 1 revision

Online message protocol

Description of the message protocol.

init

This means that the client should get ready for a new game. After this the server will either request a new move or send an opponent move (the server will always coordinate who begins each game, so the client should just wait until it's asked)

move

Only sent in the first iteration, to indicate who begins. The server will be expecting a move from the player. Moves are sent in the following format:

{big board.x},{big board.y};{small board.x},{small board.y}

Example:

The following code would play where the X is located:

2,1;1,0
1 0 0 | 0 0 0 | 0 0 0
1 0 0 | 0 0 0 | 0 0 0
1 0 0 | 1 0 0 | 0 0 0
------+-------+-------
1 0 0 | 0 0 0 | 0 X 0
0 0 0 | 0 0 0 | 0 0 0
0 0 0 | 0 0 0 | 0 0 0
------+-------+-------
0 1 0 | 0 0 0 | 0 0 0
0 0 0 | 0 0 0 | 0 0 0
0 0 0 | 0 0 0 | 0 0 0
------+-------+-------

opponent x,y;x,y

This indicates what the opponent has done, in the same format as moves requested from the player: {big board.x},{big board.y};{small board.x},{small board.y}.

After receiving this, the player should reply directly with his move.

Clone this wiki locally