ReidXtreme 5.0Game Arena setup Log in

Simultaneous moves · 100 ms per turn

Light Cycles

Two light cycles race across a grid. Each one leaves a solid wall of light behind it, and the grid slowly fills up. Hit a wall, a trail or the other bike and you are out. The last bike still moving wins.

Problem statement

Light Cycles

Two light cycles race across a grid. Each one leaves a solid wall of light behind it, and the grid slowly fills up. Hit a wall, a trail or the other bike and you are out. The last bike still moving wins.

Your task is to write a bot that steers one bike. Your bot plays many games against the judge bots on the server, and it is scored on how often it wins.

Rules

  • The board is W × H cells, with W from 15 to 25 and H from 10 to 18. x is the column (0 at the left) and y is the row (0 at the top).
  • Some cells are walls (#). Some maps have a wall all around the edge and some do not, so moving off the board is possible and is fatal.
  • Walls are symmetric under a 180° rotation about the centre of the board, and the two start cells are mirror images of each other. Neither side has an advantage.
  • Every turn both players move at the same time. Each picks UP, DOWN, LEFT or RIGHT, and then both bikes move one cell.
  • The cell a bike leaves becomes its trail. Trails are walls for both players for the rest of the game.
  • A bike is eliminated if it moves:
    • off the board,
    • into a wall,
    • into any trail, including its own (so reversing direction is always fatal), or
    • into the cell the other bike currently occupies.
  • If both bikes move into the same empty cell, both are eliminated.
  • A bot that times out, crashes or prints an invalid line is eliminated before the bikes move that turn. The other bike still moves.
  • The game ends as soon as at least one bike is eliminated. If one bike survives, it wins. If both are eliminated on the same turn, the game is a draw. If 300 turns are played the game is a draw (this cannot happen on a legal map, since every turn fills two cells).

Input and output

Your bot talks to the referee through standard input and standard output, one line at a time.

Once, at the start, you receive one line:

W H my_id

my_id is your player number, 0 or 1. The opponent is 1 - my_id.

Every turn you receive H + 3 lines:

turn T
x0 y0
x1 y1
<H lines of W characters each>
  • T is the turn number, starting at 1.
  • x0 y0 is the current cell of player 0's bike, and x1 y1 is player 1's.
  • Each board character is . for an empty cell, # for a wall, 0 for a trail or the head of player 0, and 1 for a trail or the head of player 1.

You reply with exactly one line: UP, DOWN, LEFT or RIGHT (upper case). Then flush standard output. If you do not flush, the referee never sees your move and you time out.

  • UP is y − 1, DOWN is y + 1, LEFT is x − 1, RIGHT is x + 1.
  • Blank lines are ignored, and trailing spaces and \r are removed.
  • Anything else, such as up, NORTH or 1, is an invalid move and eliminates you.
  • Print debug text to standard error only. The server's replay viewer shows your stderr turn by turn (up to 2,000 characters per turn). Standard output is read as moves only.
  • After the game ends, your standard input is closed. Your bot may simply exit when reading fails.

Example turn

Turn 2 of the game below, as seen by player 0. Player 0 is at (3, 2) having moved up from (3, 3). Player 1 is at (11, 6) having moved up from (11, 7). Both start cells are now trails.

turn 2
3 2
11 6
###############
#...##........#
#..0##....#####
#..0##....#####
#.........###.#
#.###.....###.#
#.###......1..#
#####....##1..#
#####....##...#
#........##...#
###############

From (3, 2), UP to (3, 1) and LEFT to (2, 2) are safe. RIGHT to (4, 2) is a wall and DOWN to (3, 3) is player 0's own trail, so both are fatal.

A complete short game

Player 0 keeps moving UP and drives into the top wall on turn 3. Lines starting with < are what player 0's bot receives; lines starting with > are what it prints. Player 1 receives the same lines, except that its first line is 15 11 1.

< 15 11 0
< turn 1
< 3 3
< 11 7
< ###############
< #...##........#
< #...##....#####
< #..0##....#####
< #.........###.#
< #.###.....###.#
< #.###.........#
< #####....##1..#
< #####....##...#
< #........##...#
< ###############
> UP
< turn 2
< 3 2
< 11 6
< ###############
< #...##........#
< #..0##....#####
< #..0##....#####
< #.........###.#
< #.###.....###.#
< #.###......1..#
< #####....##1..#
< #####....##...#
< #........##...#
< ###############
> UP
< turn 3
< 3 1
< 10 6
< ###############
< #..0##........#
< #..0##....#####
< #..0##....#####
< #.........###.#
< #.###.....###.#
< #.###.....11..#
< #####....##1..#
< #####....##...#
< #........##...#
< ###############
> UP

On turn 1 player 1 answered UP, and on turns 2 and 3 it answered LEFT. On turn 3 player 0 moves from (3, 1) to (3, 0), which is a wall, so player 0 is eliminated and player 1 wins. The result reads: player 0 hit a wall at (3,0) on turn 3.

Limits

LimitValue
Time per turn100 ms (aim for under 50 ms: the server's timing is what counts)
Time for your first turn2,000 ms (covers starting your program; Python and Java start slowly)
Memory256 MB
Output per turn1,024 bytes on standard output
Source fileone file, at most 100 KB
LanguagesC11 (.c), C++17 (.cpp), Python 3 (.py), Java 17 (.java, public class Main)

The server compiles your bot with:

LanguageCompileRun
C11gcc -std=c11 -O2 -pipe -o bot bot.c -lm./bot
C++17g++ -std=c++17 -O2 -pipe -o bot bot.cpp./bot
Python 3python3 -m py_compile bot.pypython3 -u bot.py
Java 17javac -d out Main.javajava -Xss64m -Xmx200m -cp out Main

C and C++ bots get a 256 MB stack, so deep recursion is fine. Your bot has no network access and cannot write files outside /tmp.

Scoring

Each submission plays every judge bot on the same 6 evaluation maps, once from each side, which is 60 games. For each judge bot j:

rate_j = (wins + 0.5 × draws) / games

Your score is the weighted sum of these rates, from 0 to 100:

score = Σ weight_j × rate_j
Judge botWeight
random_safe10
flood15
voronoi20
lookahead25
strong30

random_safe and flood are in your starter kit as source code, so you can practise against them. The other three are stronger and stay on the server, but you can play single games against any of them with the Run button.

The live leaderboard uses the best score among your submissions. At the end of the contest your final bot (the one you mark as final, otherwise your latest successful submission) is re-scored on 20 hidden maps, once from each side against every judge bot, and that score decides the final ranking. Ties are broken by the live score of that bot, then by the earlier submission time.