]> git.cworth.org Git - ttt/blobdiff - PROTOCOL
Add a dependency of ttt-client.c on ttt-lex.h to fix the build.
[ttt] / PROTOCOL
index be0f04d04a6b2a5640215c4622d366c672145c9b..91c8545b88ac96f482ca5c27893a3715ce10ba07 100644 (file)
--- a/PROTOCOL
+++ b/PROTOCOL
@@ -139,7 +139,7 @@ Document Conventions
 
        INVITE
 
-       Possible errors: NO_USER, BUSY, NO_NAME_SET
+       Possible errors: NO_NAME_SET, NO_USER, BUSY
 
     1.3.2. Accepting an invitation
 
@@ -149,17 +149,40 @@ Document Conventions
 
        ACCEPT
 
-       Possible errors: NO_NAME_SET
+       Possible errors: NO_NAME_SET, NO_USER, NO_INVITE
+
+    1.3.3. Retracting an invitiation
+
+       RETRACT <username>
+
+       ->
+
+       RETRACT
+
+       Possible errors: NO_NAME_SET, NO_USER, NO_INVITE
+
+    1.3.3. Declining an invitation
+
+       DECLINE <username>
+
+       ->
+
+       DECLINE
+
+       Possible errors: NO_NAME_SET, NO_USER, NO_INVITE
 
 1.4. In-game commands
 
+    <game> is a game id generated by the server and first returned in
+    NOTICE NEWGAME
+
     1.4.1. Get the game contents
     
-       SHOW
+       SHOW <game>
     
        ->
     
-       SHOW <game-board>
+       SHOW <game> <game-board>
     
        <game-board> is a quoted multi-line string containing an
        diagram of the tic-tac-toe board, which is a 3x3 array of
@@ -173,28 +196,28 @@ Document Conventions
     
        For example:
     
-       SHOW "
+       SHOW <game> "
        _|X|O 
         _|X|_
         X|O|O"
     
-       Possible errors: NOT_IN_GAME, NO_NAME_SET
+       Possible errors: NO_NAME_SET, NO_GAME
     
     1.4.2. Part
     
-       PART
+       PART <game>
     
        ->
     
        PART
     
-       Departs the current game
+       Departs the specified game
 
-       Possible errors: NOT_IN_GAME, NO_NAME_SET
+       Possible errors: NO_NAME_SET, NO_GAME
     
     1.4.3. Making a move
 
-       MOVE <number>
+       MOVE <game> <number>
     
        ->
     
@@ -207,7 +230,8 @@ Document Conventions
        3|4|5
        6|7|8
     
-       Possible errors: NOT_IN_GAME, NOT_YOUR_MOVE, NOT_GRID, NO_NAME_SET
+       Possible errors: NO_NAME_SET, NO_GAME, NOT_PLAYING,
+       NOT_YOUR_MOVE, NOT_GRID, NOT_VALID_MOVE
     
 2. Asynchronous notification.  
 
@@ -235,14 +259,36 @@ Document Conventions
        NOTICE QUIT <username>
     
     2.1.3. Game invitation
+
+       2.1.3.1. Invitation is made
+
+               NOTICE INVITE <username1> <username2>
+
+       2.1.3.2. Invitation is accepted
+
+               NOTICE ACCEPT <username2> <username1>
+
+       2.1.3.3. Invitation is retracted
+
+               NOTICE RETRACT <username1> <username2>
+
+       2.1.3.4. Invitation is declined
+
+               NOTICE DECLINE <username2> <username1>
+
+       The first username listed is the one performing the action.
+
+    2.1.4. New games
+
+       NOTICE NEWGAME <game> <username> <username>
     
-       NOTICE INVITE <username>
-    
-    2.1.4. Terminated games
+       The first username listed will go first.
+
+    2.1.5. Terminated games
     
        NOTICE DISPOSE <game>
     
-    2.1.5. Message
+    2.1.6. Message
 
        NOTICE MESSAGE <username> <text>
 
@@ -251,19 +297,16 @@ Document Conventions
 2.2. Game notices
 
     These notices are sent to all players and watchers in
-    the affected game
+    the affected game.
 
-    2.2.1. Global game notices
-
-       2.2.1.1. New game begins
+    <game> is a game id generated by the server and first returned in
+    NOTICE NEWGAME
 
-           NOTICE NEWGAME <username> <username>
-
-           The first username listed will go first
+    2.2.1. Global game notices
 
-       2.2.1.2. Game over, and winner
+       2.2.1.1. Game over, and winner
 
-           NOTICE GAMEOVER <outcome> <username>
+           NOTICE GAMEOVER <game> <outcome> <username>
 
            <outcome> is either WON in which case <username> indicates
            the winner or CATSGAME in which case <username> is "".
@@ -272,7 +315,7 @@ Document Conventions
 
        2.2.2.1. Move
        
-           NOTICE MOVE <username> <number>
+           NOTICE MOVE <game> <username> <number>
 
 3. Errors
 
@@ -289,13 +332,15 @@ Document Conventions
        'helo' must be sent before any command other than 'help',
        'version', 'quit'.
 
-       Possibly returned by: WHO MESSAGE INVITE ACCEPT SHOW PART MOVE
+       Possibly returned by: WHO, STATISTICS, MESSAGE, INVITE,
+       ACCEPT, RETRACT, DECLINE, SHOW, PART, MOVE
     
     3.1.2. Invalid name
     
        ERROR INVALID_NAME
     
-       All names must be of non-zero length and must be unique.
+       All names must be of non-zero length and must be unique,
+       though case-insensitive.
 
        Possibly returned by: HELO
 
@@ -307,39 +352,56 @@ Document Conventions
     
        ERROR COMMAND
     
-       An invalid command was specified
-    
+       An invalid command was specified.
+
     3.2.2. Syntax
     
        ERROR SYNTAX
     
-       A syntax error was detected
+       A syntax error was detected.
     
     3.2.3. Not number
     
        ERROR NOT_NUMBER
     
-       A non-numeric value was supplied where a number was required
+       A non-numeric value was supplied where a number was required.
        
+       Possibly returned by: MOVE
+
     3.2.4. Not a grid number
     
        ERROR NOT_GRID
     
-       The number specified in the command was not a valid grid number
-    
+       The number specified in the command was not a valid grid
+       number.
+
+       Possibly returned by: MOVE
+
 3.3. Global command errors.
 
-    There are no errors from any of the global commands
+    There are no global command errors from any of the global
+    commands.
 
 3.4. Game management errors.
 
     Errors from game management commands
     
-    3.4.1. No such game
+    3.4.1. No invitiation from/for specified user
+
+       ERROR NO_INVITE
+
+       An invitiation action was attempted where no invitation
+       exists.
+
+       Possibly returned by: ACCEPT, RETRACT, DECLINE
+
+    3.4.2. No such game
        
        ERROR NO_GAME
        
-       A game name was provided that does not exist.
+       A game id was provided that does not exist.
+
+       Possibly returned by: SHOW, PART, MOVE
        
 3.5. User information errors
 
@@ -349,25 +411,21 @@ Document Conventions
 
        A user name was provided that does not exist.
 
+       Possibly returned by: STATISTICS, INVITE, ACCEPT, RETRACT,
+       DECLINE
+
 3.6. In-game errors
 
     3.6.1. Global game errors
     
-       3.6.1.1. Not in game
-    
-           ERROR NOT_IN_GAME
-    
-           A game playing command was made, but the user is not a
-           particpant of any game.
-    
-           Possibly returned by: MOVE
-
-       3.6.1.2. Not playing
+       3.6.1.1. Not playing
 
            ERROR NOT_PLAYING
 
            A command was executed by a watching user that is
-           permitted only to players
+           permitted only to players.
+
+           Possibly returned by: MOVE
     
     3.6.2. Moving errors 
     
@@ -375,6 +433,14 @@ Document Conventions
 
            ERROR NOT_YOUR_TURN
     
-           A move was submitted during the other player's turn
+           A move was submitted during the other player's turn.
+
+           Possibly returned by: MOVE
+
+       3.6.2.2. Not a valid move
+
+           ERROR NOT_VALID_MOVE
+
+           A move was submitted for a cell that is occupied.
 
            Possibly returned by: MOVE