The Goal

Capture opponent's flag and take it to your base before them!

  Rules

The game is played on a 2D grid given to you at the start of the game. The grid is made up of walls and empty spaces. Each player controls a team of minions that can move along the grid.

The Map

The grid is generated randomly, and can vary in height and width. Each cell of the map is either:

  • A wall (represented by a pound character: #)
  • An empty space (represented by a dot character: .)

Maps are always symmetrical across the central vertical axis. Minions cannot go pass the border of the map or go through walls. They can only pass through empty cells. Empty cells may contain coins. Minions can collect coins as they move over cells that contain coins. Collecting coins increases the score of the player.

The Minions

Each player starts with the same number of minions, up to 5 each.

Your minions cannot see through walls. On each turn you have vision on all of the enemy minions and coins that can be connected by a continuous straight line to any one of your minions.

At each turn, you are given information regarding your own alive minions, the opponent's visible minions and all the visible coins. For each minion, you are given its identifier, its coordinates and its health. For each coins, you are given its coordinates.

Minions can receive the following commands (a minion can only receive one command per turn):
  • MOVE: Give the minion a target position. The minion will find a shortest route to that position and make the first move along the way. The minion will not take into account the presence of other minions when choosing a route.
  • WAIT: Do nothing.

Minions can also receive special commands which enables it to perform a powerup which can deal damage to the opponent minions. Refer to the the power up section.

See the Game Protocol section for more information on sending commands to your minion. Note that, minions never collide and multiple minions can exist in the same cell.

Flag and Flag Base

Each player's flag resides at the flag-base in the beginning of the game. A player's minions can only carry opponent's flag. Note that each player's minions cannot carry their own flag. A flag can be carried by only one minion at a time. Once a minion obtains a flag, it cannot let it go until it is dead. Following the flag-carrying-minion's death, the flag remains at that cell where the minion died until some other minion picks it up.

Game end

There are 3 types of power ups that a minion can use.

  • FIRE: A minion that uses fire will ignite every cell in its vision with fire. That is, the whole row and the whole column up until the nearest wall will be ignited. Any opponent minion caught in this fire will take damage.
  • FREEZE: A minion that uses freeze will freeze every cell in its vision with ice. That is, the whole row and the whole column up until the nearest wall will be frozen. Any opponent minion caught in this ice will be frozen (stuck) in its position for timeout amount of time.
  • MINE: A minion that uses mine can plant a bomb at a certain cell of the grid. Any opponent minion that walks over that cell will trigger the bomb to explode. Once a bomb explodes, the opponent minion takes damage.

Each power up requires a certain score. Refer to protocol section on how to use power up command.

Game end

Game can end on any of the following 3 conditions:

  • One of the player's minions captures opponent's flag and returns to its own flag-base.
  • All the minions of a player are killed.
  • The game doesn't end on any of the two conditions above for more than 200 rounds. In that case, the player with the highest score wins and the game is forcefully ended.

  Game Input

Initialization Input
Line 1: two integers height and width - the size of the maze.
Next height lines: a string of width characters each representing one cell of a row: '.' is an empty cell and '#' is a wall.
Next line: two integers: my_flag_base_x & my_flag_base_y - player's flag-base position
Next line: two integers: opponent_flag_base_x & opponent_flag_base_y - opponent's flag-base position
Next 3 lines: powerUpName , powerUpPrice & powerUpDamage
Input for Each Game Turn
Line 1: two integers:
  • my_score & opponent_score - player's and opponent's current score
Line 2: three integers:
  • my_flag_pos_x, my_flag_pos_y & my_flag_carrier - player's flag position and carrier of flag by opponent's minion (-1 if no minion is carrying)
Line 3: three integers:
  • opponent_flag_pos_x, opponent_flag_pos_y & opponent_flag_carrier - opponent's flag position and carrier of opponent's flag by player's minion (-1 if no minion is carrying)
Line 4: my_alive_minion_cnt - number of player's alive minions
Next my_alive_minion_cnt lines:
  • id pos_x pos_y health timeout - player's minion's id, position, health & timeout
Next Line: visible_minion_cnt - number of opponent's visible minions
Next visible_minion_cnt lines:
  • id pos_x pos_y health timeout - opponent's minion's id, position & health
Next Line: visible_coin_cnt - number of coins visible by player's minions
Next visible_coin_cnt lines:
  • pos_x pos_y coin position
Output
A single line with one or multiple commands separated by |. For example: MOVE 0 5 7 | MOVE 1 16 10.
  • MOVE minionID x y: the minion with the identifier minionID moves towards the given cell.
  • FIRE minionID: the minion with the identifier minionID uses FIRE.
  • FREEZE minionID: the minion with the identifier minionID uses FREEZE.
  • MINE minionID x y: the minion with the identifier minionID plants mine at (x,y).
  • WAIT minionID: the minion with the identifier minionID does nothing.
Constraints
TBD