1 Tic-tac-toe Protocol (TTTP)
5 Carl Worth Richard Worth Kevin Worth
6 carl@theworths.org richard@theworths.org kevin@theworths.org
10 TTTP is a network protocol for playing the game tic-tac-toe. It permits
11 a single server to host multiple games with named participants. The
12 protocol is designed so that people can play using only telnet, but it is
13 expected that graphical interfaces will be able to drive the protocol as
16 TTTP borrows heavily from RRGP (Ricochet Robot Game Protocol) by Keith
17 Packard and indirectly from other network protocols like SMTP using a
18 synchronous command interface.
22 All commands include a response (yeah, synchronous protocols are
40 The TTTP server has no well defined port; agreement on which port to
41 use must be done through some external mechanism. Once connected,
42 the client must identify itself:
48 HELO <servername> <username> <server-addr> <server-port>
50 If the client doesn't supply <username>, the server will compute
53 Possible errors: INVALIDNAME
57 1.2.1 Listing available users
63 WHO <username1> <games1> <username2> <games2> ...
65 lists connected users and the number of games they've won.
79 Displays help. If <command> is provided, displays more
80 detailed help on a specific command, otherwise displays an
81 overview of all commands.
93 VERSION <client-version-number>
97 VERSION <server-version-number>
99 Negotiates version number between client and server. The server
100 will respond with a version no higher than the client version
101 number, but it may be lower. Version numbers are integers.
103 This document describes protocol version 1.
105 1.3. Game management commands
107 1.3.1. Inviting a player to play a game
115 Possible errors: NOUSER, BUSY
117 1.3.2. Accepting an invitation
125 1.4. In-game commands
127 1.4.1. Get the game contents
135 <game-board> is a quoted multi-line string containing an
136 diagram of the tic-tac-toe board, which is a 3x3 array of
143 c = '_' for empty or 'X' or 'O' for a played space
152 Possible errors: NOTINGAME
162 Departs the current game
164 Possible errors: NOTINGAME
174 <number> indicates a number in the tic-tac-toe grid as
181 Possible errors: NOTINGAME, NOTYOURMOVE, NOTGRID
183 2. Asynchronous notification.
185 The server will send notices to each user in a game whenever
186 there is a move. It will also send notices to every connected
187 client when additional people join or new games are
188 started. These are of the form:
190 NOTICE <notice-code> <args>
192 Game-specific notices are sent to users involved in the related
193 game, other notices are sent to all users. Note that even the user
194 originating the notice receives a copy.
198 These notices are sent to all connected clients
202 NOTICE USER <username>
204 2.1.2. Disconnected user
206 NOTICE QUIT <username>
208 2.1.3. Game invitation
210 NOTICE INVITE <username>
212 2.1.4. Terminated games
214 NOTICE DISPOSE <game>
218 NOTICE MESSAGE <username> <text>
222 These notices are sent to all players and watchers in
225 2.2.1. Global game notices
227 2.2.1.1. New game begins
229 NOTICE NEWGAME <username> <username>
231 The first username listed will go first
233 2.2.1.2. Game over, and winner
235 NOTICE GAMEOVER <outcome> <username>
237 <outcame> is either WON in which case <username> indicates
238 the winner or CATSGAME in which case <username> is "".
244 NOTICE MOVE <username> <number>
248 The following error codes may be returned.
250 3.1. Connection setup errors
252 These errors occur during connection setup.
258 'helo' must be sent before any command other than 'quit'.
264 All names must be unique.
266 Possibly returned by: HELO
268 3.2. Command format errors
270 Errors caused by ill-formed commands
276 An invalid command was specified
282 A syntax error was detected
288 A non-numeric value was supplied where a number was required
290 3.2.4. Not a grid number
294 The number specified in the command was not a valid grid number
296 3.3. Global command errors.
298 There are no errors from any of the global commands
300 3.4. Game management errors.
302 Errors from game management commands
308 A game name was provided that does not exist.
310 3.5. User information errors
316 A user name was provided that does not exist.
320 3.6.1. Global game errors
326 A game playing command was made, but the user is not a
327 particpant of any game.
329 Possibly returned by: MOVE
335 A command was executed by a watching user that is
336 permitted only to players
340 3.6.2.1. Not your turn
344 A move was submitted during the other player's turn
346 Possibly returned by: MOVE