Tron Specification

Contents

  1. Bot Input
  2. Bot Output
  3. Gameover Conditions
  4. Rankings
  5. Map File Format
  6. Map Generator(s)
  7. Match File Format

Bot Input

Parameter Information

At the beginning of a match, each bot is passed parameters about the match, starting with turn 0 on its own line. Parameters will then be passed on separate lines with the format type value. The set of parameters passed to bots may be added to in the future, bots should be able to handle this happening without breaking. The list of parameters currently passed to bots is below:

loadtime   #number of milliseconds that your bot has to setup
turntime   #number of milliseconds your bot has each turn
no_rows    #number of rows for the map
no_cols    #number of columns for the map
no_players #number of players
bot_id     #your bot id
map        #followed by no_rows lines of no_cols chars giving the map

After the parameters will be map on its own line, followed by no_rows lines of no_cols chars (not separated by spaces) giving the map. Finally the map will be followed by ready on its own line.

Your bot will be given a parameter loadtime which is the number of milliseconds from the moment the server sends ready that your bot has to indicate back to the server that it is ready for the match to start, which is done by the server receiving go from your bot. If your bot fails to return go within loadtime milliseconds the match will be over for your bot.

Turn Information

The start of each turn will begin with the server sending turn turn_no on its own line to your bot. There will be lines following with the current location for each bot still remaining in the match in the format p bot_id row col. Finally go will be sent on its own line from the server to the bot to indicate that the turn has started. Your bot has turntime milliseconds from when the server sends go for the server to receive a valid move back.

Gameover Information

The server will indicate to your bot that the match if over for you by sending end on its own line at the start of a turn.

Sample Input


turn 0
loadtime 3000
turntime 1000
no_rows 20
no_cols 30
no_players 3
bot_id 0
map
ready

turn 1
p a 5 5
p b 10 15
p c 15 25 
go

turn 2
p a 6 5
p b 10 14
p c 14 25
go

end

Bot Output

From when the server sends go to your bot at the start of a turn, you have turntime milliseconds for the server to receive a valid move from your bot. Valid moves are n, e, s and w which indicate moving north, east, south and west respectively.

Gameover Conditions

Any of the following conditions will be gameover for a bot:

  • timing out during the set up of the match (ie. failing to send go to the server within loadtime of the server sending ready to the bot);
  • crashing in to a wall (including locations that have already been visited by one of the bots);
  • sending an invalid command to the server;
  • timing out during a turn of the match (ie. failing to send a valid move to the server within turntime of the server sending go to the bot during one of the turns).

The server will indicate to your bot that the match if over for you by sending end on its own line at the start of a turn.

Rankings

For information on how ELO ratings are calculated for two player games, see the Wikipedia page for the ELO rating system along with this blog post. The ELO ratings for tron are calculated as follows.

For a given match let:

  • $\text{ELO}_p^{\text{old}}$ be the old ELO rating of player $p$, ie. before the match;
  • $\text{ELO}_p^{\text{new}}$ be the new ELO rating of player $p$, ie. after the match;
  • $E_{p,q}$ be the expected score of player $p$ against player $q \neq p$; and
  • $A_{p,q}$ be the actual score of player $p$ against player $q \neq p$.

For each distinct players $p, q \in P$, the expected score of player $p$ is calculated as \[E_{p,q} = \frac{1}{1+10^{(\text{ELO}_q^{\text{old}} - \text{ELO}_p^{\text{old}})/400}},\] and the actual score for player $p$ is $A_{p,q} = \begin{cases}1 & p \text{ wins;}\\0.5 & \text{draw; and}\\0 & q \text{ wins.}\end{cases}$

The ELO rating of player $p$ after the match is calculated as: \[\text{ELO}_p^{\text{new}} = \text{ELO}_p^{\text{old}} + K{\large\Sigma}_{q \neq p}(A_{p,q} - E_{p,q})\]

New players start with an ELO rating of $2000$ and a $K$ factor of $24$ is being used.

Map File Format

At the beginning of a map file is parameters about the map, with the format type value. The set of parameters may be added to in the future, anything processing map files should be able to handle this happening without breaking (eg. match servers). The list of parameters currently included in a map file is below:

no_rows    #number of rows for the map
no_cols    #number of columns for the map
no_players #number of players

After the parameters will be map on its own line, followed by no_rows lines of no_cols chars (not separated by spaces) giving the map. An example map file is as follows:

no_rows 20
no_cols 30
no_players 3
map
..............................
..............................
...a..........................
.........%%%%%%%%%%...........
..............................
..............................
..............................
..............................
.............b................
...................%%%%%%%%%%.
..............................
..............................
..............................
..............................
..............................
.......................c......
%%%%%%%%%....................%
..............................
..............................
..............................

Map Generator(s)

Details to come.

Match File Format

The server generates a match file at the end of each match which is used to update the ranks and loaded by the match-viewer on the site.

At the beginning of a match file is parameters about the match, with the format type value. The set of parameters may be added to in the future, anything processing match files should be able to handle this happening without breaking (eg. match viewers). The list of parameters currently included in a match file is below:

no_rows    #number of rows for the map
no_cols    #number of columns for the map
no_players #number of players
usernames  #list of usernames

After the parameters will be map on its own line, followed by no_rows lines of no_cols chars (not separated by spaces) giving the map.

After the map will be no_moves followed by the number of moves from each of the players, and after the number of moves will be moves followed by a string for each player containing the moves for that player.

An example match file is as follows:

no_rows 10 
no_cols 17
no_players 9
usernames antimatroid testbot duckbot pwnworthy betty kate p1 p2 p3 
map
................. 
.b....d..........
........%....c... 
...%....%%%...... 
........%.%...... 
........%.%...... 
.................
e..a......f......
.....ghi.........
.................

no_moves 6 10 8 4 4 1 1 1 1

moves 
	nnwsww
	wwwwwwwwss
	nneeennw
	nent
	nnni
	f
	t
	t
	t

Major Sponsors