Modified manager output/protocol, added "basic" AI, made Asmodeus better
[progcomp2012.git] / manager / manual.txt
index 55a8f05..e7a15d1 100644 (file)
@@ -64,7 +64,7 @@ OPTIONS
                
 
 GAME RULES
-               Each player sets up 40 pieces on the Board. The pieces consist of the following:
+               Each player controls up to 40 pieces on the Board. The pieces consist of the following:
 
                Piece   Name            Rank    Number  Abilities
                1       Marshal         1       1       Dies if attacked by Spy
@@ -77,16 +77,24 @@ GAME RULES
                8       Miner           8       5       Destroys Bombs without being killed
                9       Scout           9       8       May move more through multiple empty squares
                s       Spy             10      1       If the Spy attacks the Marshal, the Marshal dies
-               B       Bomb            NA      6       Immobile. If an enemy piece (except a Miner) encounters a Bomb, both pieces are destroyed
-               F       Flag            NA      1       Immobile. If any enemy piece encounters the Flag, the controlling player wins.
+               B       Bomb            NA      6       Immobile. If any piece (except a Miner) encounters an enemy Bomb, both pieces are destroyed
+               F       Flag            NA      1       Immobile. If any piece encounters the enemy Flag, the controlling player wins.
+
+               Additional pieces, not controlled by the player:
+               Piece   Name                    Number  Notes
+               +       Obstacle                8       Immobile. Do not belong to either player. Can't be passed through.
+               #       Enemy Piece             0 - 40  Indicates that the position on the board is occupied by an enemy piece.
+               .       Empty                   NA      Indicates that the position on the board is empty.
+               
+               Players take turns to move their pieces. RED begins the game.
 
-               Pieces may move one square horizontally or vertically unless otherwise stated.
-               Pieces may not move through squares occupied by allied pieces.
-               Pieces may move into squares occupied by enemy pieces, in which case the piece with the lower rank (higher number) is destroyed.
+               Pieces may only move one square horizontally or vertically unless otherwise stated.
+               Pieces may not move through squares occupied by allied pieces, or Obstacle (+) pieces.
+               Pieces may move into squares occupied by Enemy Pieces (#), in which case the piece with the lower rank (higher number) is destroyed.
 
                Each player's pieces are hidden from the other player. When two pieces encounter each other, the ranks will be revealed.
 
-               The objective is to destroy all enemy pieces or capture the Flag.
+               The objective is to destroy all Enemy Pieces (#) or capture the Enemy Flag (also #).
                
 
 PROTOCOL
@@ -100,32 +108,46 @@ PROTOCOL
                RESPONSE: 4 lines, each of length BOARD_WIDTH, of characters. Each character represents a piece. The characters are shown above.
 
        2. TURN
-               QUERY: START | CONFIRMATION
+               QUERY:  START | CONFIRMATION
+                       BOARD_STATE
+
                        On the first turn, "START" is printed to the Red player.
                        On subsequent turns, the CONFIRMATION of the opponent's last turn is printed (see below).
 
-               RESPONSE: X Y DIRECTION [MULTIPLIER=1]
+                       BOARD_STATE consists of a BOARD_HEIGHT lines of length BOARD_WIDTH characters, each of which represents a single piece
+                       as described in the GAME_RULES section. Each line ends with the newline character.
+                       
+
+               RESPONSE: X Y DIRECTION [MULTIPLIER=1] | NO_MOVE
                        X and Y are the coords (starting from 0) of the piece to move
                        DIRECTION is either UP, DOWN, LEFT or RIGHT
                        MULTIPLIER is optional and only valid for units of type Scout. Scouts may move through any number of unblocked squares
                        in one direction.
 
-               CONFIRMATION: X Y DIRECTION [MULTIPLIER=1] OUTCOME
+                       The AI program should print "NO_MOVE" if it is unable to determine a move.
+                       This will typically occur when the only pieces belonging to the AI program are Bombs and the Flag.
+
+               CONFIRMATION: X Y DIRECTION [MULTIPLIER=1] OUTCOME | NO_MOVE | QUIT RESULT
                        OUTCOME may be either OK, ILLEGAL, KILLS or DIES
                                OK - Move was successful
                                ILLEGAL - Move was not allowed. If stratego was not started with the -i switch, the game will end.
                                KILLS ATTACKER_RANK DEFENDER_RANK - The piece moved into an occupied square and killed the defender.
                                DIES ATTACKER_RANK DEFENDER_RANK - The piece moved into an occupied square and was killed by the defender.
 
+                       A confirmation of "NO_MOVE" occurs when the AI program made no move for a legitimate reason.
+                       "NO_MOVE ILLEGAL" is printed if the AI program made no move for an illegitimate reason.
+
+                       If both AI programs successively make a "NO_MOVE" response, then the game will end.
+                       The player with the highest piece value will win, or a draw will be declared if the values are equal.
+
+
        3. END GAME
-               QUERY: VICTORY | DEFEAT | ILLEGAL | DEFAULT
-                       VICTORY - This player won the game
-                       DEFEAT - The other player won the game
-                       ILLEGAL - Game ended because this player made a bad response or timed out
-                               (NOTE: Even if the -i option is provided, the game may end with an ILLEGAL signal if a bad response is made)
-                       DEFAULT - Game ended because the other player made a bad response.
-
-                       No response is necessary; the program should exit or it will be sent a SIGKILL signal.
+               If the CONFIRMATION line is of the form:
+                       QUIT RESULT
+               Then the game is about to end.
+       
+               If present, RESULT will be a direct copy of the message to stdout described in the EXIT/OUTPUT section below.
+               
        
        4. TIMEOUTS
                If a program fails to respond to a query within 2 (two) seconds, the game will end and that AI will be sent the ILLEGAL result.
@@ -136,15 +158,30 @@ PROTOCOL
 EXIT/OUTPUT
        If the game ends due to a player either winning, or making an illegal move, stratego will print one of the following result messages to stdout.
 
-       1.
-               WINNING_NAME WINNING_COLOUR TURNS
-       2.
-               DRAW TURNS
-               When the result was a draw
+       NAME COLOUR OUTCOME TURN_NUMBER OUTCOME RED_PIECE_VALUE BLUE_PIECE_VALUE
+
+       Where:
+               NAME is the name of the player on whose turn the game ended,
+               COLOUR is the colour of that player,
+               OUTCOME is one of the following:
+                       VICTORY - The indicated player won
+                       DEFEAT - The indicated player lost
+                       SURRENDER - The indicated player surrendered
+                       DRAW - The game ended in a draw because neither player moved
+                       DRAW_DEFAULT - The game ended in a draw because the maximum number of moves was exceeded
+                       ILLEGAL - The indicated player loses due to an Illegal move/response
+                       DEFAULT - The indicated player wins by default due to the other player making an Illegal move/response
+                       BOTH_ILLEGAL - Both players made an Illegal move/response. Usually occurs due to simultaneous setup errors, or bad executable paths.
+                       INTERNAL_ERROR - The game ended, even though it shouldn't have.
+                       
+               TURN_NUMBER is the number of turns that elapsed before the game ended
+
+               RED_PIECE_VALUE and BLUE_PIECE_VALUE are the summed piece values of the pieces of RED and BLUE respectively.
+               Bombs and Flags are worth zero, and the ranked pieces (Spys -> Marshal) are worth (11 - rank).
+               So the Spy is worth 1 point, ... the Marshal is worth 10.
 
-       3.
-               NONE TURNS
-               When for some reason both the AI programs failed to respond or crashed.
+               (The initial piece values can be determined by running with -m 0)
+               
 
        stratego will then return exit code 0.
 

UCC git Repository :: git.ucc.asn.au