Fixed error in asmodeus.py due to stupidity
[progcomp2012.git] / manager / manual.txt
1 NAME
2         stratego - Interface to manage games of stratego between AI programs and/or human players
3         
4 WARNING
5         This program is still a work in progress. Consider it a Beta version.
6
7 SYNOPSIS
8         stratego {[-gpirb] [-o output_file ] [-t stall_time] [-m max_turns] {red_player blue_player | -f input_file} | {-h | --help} }
9
10 DESCRIPTION
11         stratego manages a game of Stratego. It stores the state of the board, and uses a simple protocol to interface with AI programs.
12         By itself, stratego does not "play" the game. An external AI program must be used. stratego is intended to be used for the testing of 
13         various AI strategies, written in any programming language. It will be used for the UCC Programming Competition 2012.
14
15         Unless the -h (--help) or -f switch is given, both red_player and blue_player must be supplied.
16
17         red_player
18                 Should be either a path to an executable file which will control the Red player, or "human".
19                 If set to "human", stratego will request the user to make moves for the Red player using stdin.
20                 NOTES
21                         1. There is no plan to support AI programs named "human". Deal with it.
22                         2. As of writing, human players must use stdin. A graphical interface may be added later.
23
24         blue_player
25                 As red_player, except for controlling the Blue player.
26         
27 OPTIONS
28         -g
29                 By default, graphics are disabled. If the -g switch is present, stratego will draw the game as it is played using OpenGL
30         -p
31                 By default, even if graphics are disabled, the board state is not printed. If -p is present, the board will be printed to stdout.
32                 If the system supports colour, the characters will be in colour.
33                 If -p and -g are both present you will see both behaviours (overkill)!
34         -i
35                 By default, stratego will exit if a move which is deemed "illegal" is made. If the -i switch is present, illegal moves will be ignored.
36                 That is, the move will not be made (effectively the player making the illegal move loses a turn).
37         -r
38                 By default, the identities of all pieces are shown. If the -r switch is present, and graphics are enabled, red pieces will be disguised.
39                 If graphics are disabled, the -r switch has no effect.
40         -b
41                 As -r, except blue pieces will be disguised.
42                 NOTE: Both -r and -b may be used.
43         -o
44                 By default, stratego is silent. If the -o switch is present, the result of each move is printed to a file. If output_file is "stdout"
45                 then stdout will be used instead of a text file.
46         -t
47                 By default, stratego executes moves as fast as they are recieved. If the -t switch is present, a delay of stall_time will be introduced
48                 between each move.
49
50         -m
51                 By default, the game is declared a Draw after 5000 turns have ellapsed.
52                 Use this option to change the maximum number of turns.
53                 To play for an infinite number of turns, supply "inf" as max_number.
54
55         -f
56                 By default, stratego requires red_player and blue_player to enact a game.
57                 If this option is supplied, a file previously produced by using the -o switch is read, and the game reenacted.
58                 All switches function as normal with -f.
59                 NOTE: It is recommended that -g is used with -f.
60
61         -h, --help
62                 If the -h switch is used, this page will be printed and stratego will exit.
63                 
64                 
65
66 GAME RULES
67                 Each player sets up 40 pieces on the Board. The pieces consist of the following:
68
69                 Piece   Name            Rank    Number  Abilities
70                 1       Marshal         1       1       Dies if attacked by Spy
71                 2       General         2       1       
72                 3       Colonel         3       2       
73                 4       Major           4       3       
74                 5       Captain         5       4       
75                 6       Lieutenant      6       4
76                 7       Sergeant        7       4
77                 8       Miner           8       5       Destroys Bombs without being killed
78                 9       Scout           9       8       May move more through multiple empty squares
79                 s       Spy             10      1       If the Spy attacks the Marshal, the Marshal dies
80                 B       Bomb            NA      6       Immobile. If an enemy piece (except a Miner) encounters a Bomb, both pieces are destroyed
81                 F       Flag            NA      1       Immobile. If any enemy piece encounters the Flag, the controlling player wins.
82
83                 Pieces may move one square horizontally or vertically unless otherwise stated.
84                 Pieces may not move through squares occupied by allied pieces.
85                 Pieces may move into squares occupied by enemy pieces, in which case the piece with the lower rank (higher number) is destroyed.
86
87                 Each player's pieces are hidden from the other player. When two pieces encounter each other, the ranks will be revealed.
88
89                 The objective is to destroy all enemy pieces or capture the Flag.
90                 
91
92 PROTOCOL
93         In order to interface with stratego, an AI program must satisfy the following protocol. 
94         Each query is followed by a newline, and responses are expected to be followed with a newline.
95         The queries are recieved through stdin, and responses should be written to stdout.
96         
97         1. SETUP
98                 QUERY: YOUR_COLOUR OPPONENT_ID BOARD_WIDTH BOARD_HEIGHT
99
100                 RESPONSE: 4 lines, each of length BOARD_WIDTH, of characters. Each character represents a piece. The characters are shown above.
101
102         2. TURN
103                 QUERY: START | CONFIRMATION
104                         On the first turn, "START" is printed to the Red player.
105                         On subsequent turns, the CONFIRMATION of the opponent's last turn is printed (see below).
106
107                 RESPONSE: X Y DIRECTION [MULTIPLIER=1]
108                         X and Y are the coords (starting from 0) of the piece to move
109                         DIRECTION is either UP, DOWN, LEFT or RIGHT
110                         MULTIPLIER is optional and only valid for units of type Scout. Scouts may move through any number of unblocked squares
111                         in one direction.
112
113                 CONFIRMATION: X Y DIRECTION [MULTIPLIER=1] OUTCOME
114                         OUTCOME may be either OK, ILLEGAL, KILLS or DIES
115                                 OK - Move was successful
116                                 ILLEGAL - Move was not allowed. If stratego was not started with the -i switch, the game will end.
117                                 KILLS ATTACKER_RANK DEFENDER_RANK - The piece moved into an occupied square and killed the defender.
118                                 DIES ATTACKER_RANK DEFENDER_RANK - The piece moved into an occupied square and was killed by the defender.
119
120         3. END GAME
121                 QUERY: VICTORY | DEFEAT | ILLEGAL | DEFAULT
122                         VICTORY - This player won the game
123                         DEFEAT - The other player won the game
124                         ILLEGAL - Game ended because this player made a bad response or timed out
125                                 (NOTE: Even if the -i option is provided, the game may end with an ILLEGAL signal if a bad response is made)
126                         DEFAULT - Game ended because the other player made a bad response.
127
128                         No response is necessary; the program should exit or it will be sent a SIGKILL signal.
129         
130         4. TIMEOUTS
131                 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.
132                 Human players are not subject to the timeout restriction.
133                 
134                         
135
136 EXIT/OUTPUT
137         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.
138
139         1.
140                 WINNING_NAME WINNING_COLOUR TURNS
141         2.
142                 DRAW TURNS
143                 When the result was a draw
144
145         3.
146                 NONE TURNS
147                 When for some reason both the AI programs failed to respond or crashed.
148
149         stratego will then return exit code 0.
150
151         If an error occurs within stratego itself, an error message will be printed to stderr and return exit code 1.
152         If possible, stratego will print the message "QUIT" to both AI programs, and they should exit as soon as possible.
153         
154
155 BUGS
156         There are no known bugs at this time. However, stratego is still a work in progress. Report a bug to the AUTHOR (see below).
157
158 AUTHORS
159         Sam Moore (for the UCC Programming Competition 2012) <[email protected]>
160
161 NOTES
162         0. This program is still a work in progress and subject to changes.
163         
164         1. UCC Programming Competition 2012 Description
165            http://matches.ucc.asn.au/stratego/
166
167         2. UCC Programming Competition 2012 Git repository
168            git://git.ucc.asn.au/progcomp2012.git
169
170  
171         3. IRC Channel
172            irc://irc.ucc.asn.au #progcomp
173         

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