The statement was updated. Refer to FREEZE on Flag Carrier section

  The Goal

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

  Rules

The game is played on a 2D grid, made up of walls and empty cells. Both players control a team of minions. The game is played on turns. On each turn, both the player should output a command that tells each minions to move along the grid, collect coins, capture opponent flag or use power-ups to damage oppnent minions.

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 cell (represented by a dot character: .)

Maps are always symmetrical across the central vertical axis. Minions can move along the map only through empty cells, they cannot pass through walls. The map is surrounded by walls and hence, minions cannot go pass the border of the map. Empty cells may contain coins. height of the map (number of rows) will be in range 17 to 20 and width of the map (number of columns) will be in range 33 to 35.

Minions

Each player starts with the same number of minions, starting from 3 to a maximum of 5 minions per player.

Each minion starts with a health of 100 hp. Minions take damage when a power-up is used against them and they lose some hp, decreasing their health. A minion whose health drops below 1 dies and is removed from the game. A dead minion never returns back to the game.

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. That is, a single minion can see everything along the row and column it is in unless blocked by a wall. A player's vision is the collected vision of all his/her minions.

The white minion's vision is indicated by the arrows. It has vision on 2 opponent (red) minions.

Minions can receive the following commands (a minion can receive only one command per turn):

  • MOVE: Give the minion a target position. The minion will find a shortest route to that position and move to the first empty cell along that route. The minion will not take into account the presence of any other minions or coins when choosing the route.
  • WAIT: Do nothing.
  • FIRE: The minion uses the power-up fire. Refer to power-up section.
  • FREEZE: The minion uses the power-up freeze. Refer to power-up section.
  • MINE: The minion uses the power-up mine. Refer to power-up section.

Note that, minions never collide and multiple minions can exist in the same cell.

Flag and Flag Base

Each player's flag resides at their respective 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 drop the flag 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.

Power Ups

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

  • FIRE: A minion that uses fire ignites every cell in its vision. That is, all the empty cells that can be connected with a continuous straight line starting from that minion's position (along the row and column) will be ignited. Any minion caught in this fire will take 24 damage. Cost of using a fire is 7 score points.
    The minion marked with red circle uses FIRE, igniting all the empty cells in the row and column unless blocked by a wall. The minion marked with white circle takes damage by the fire.
  • FREEZE: A minion that uses freeze freezes every cell in its vision. That is, all the empty cells that can be connected with a continuous straight line starting from that minion's position (along the row and column) will be frozen. Any minion caught in this freeze will be timed out for 4 turns. A timed out minion cannot do anything. Any commands given to a timed out minion won't have any impact. Cost of using a freeze is 12 score points.
    The minion marked with red circle uses FREEZE, freezing all the empty cells in the row and column unless blocked by a wall. The minion marked with white circle is timed out for 4 turns due to being frozen.

    FREEZE on Flag Carrier

    When a flag carrier minion is timed-out, i.e FREEZE is exerted on a flag carrier minion, the minion drops the flag in the cell where it is timed-out. When the timeout becomes 0 for that minion aka the minion is unfrozen, it immediately picks the flag up again. It is also possible for another minion to pick up the flag during the period it was dropped due to the carrier being timed-out


  • MINE: A minion that uses mine can plant a bomb at any empty cell adjacent to the current position of that minion. Once planted, the bomb will remain in that position until some minion walks over that cell. Once a minion (including the one who planted the bomb) walks over that cell the bomb will explode. Once a bomb explodes, any minion within a radius of 2 will take 30 damage. The explosion impact does not go through walls and walls are unaffected by the explosion. Cost of using a mine is 15 score points.

    Note that minions cannot see whether there is a mine planted on a cell or not.

    The minion is about to take a step into a cell where a mine is planted.
    The mine is triggered and explodes with a radius of 2, dealing 30 damage to anyone caught in explosion.

Note that, all the power-ups have friendly fire on. That is, each of the power-ups affect opponent and teammate minions equally. Only the minion that uses FIRE or FREEZE is unaffected by that action. Also note that, MINE affects every minions, including the one who planted the bomb.

Coins

At the start of the game, all the empty cells contain a coin. Each coin is worth 1 score point. A minion can collect a coin if it walks over a cell that contains a coin. Once a coin has been collected, it disappears and never reappears. A player starts with 0 score points

Victory Conditions
  • Your minion has returned to your base with the opponent's flag before opponent took your flag to their base
  • All opponent minions are killed.
  • If both the flags were captured at the same time, then you have more alive minions than your opponent
  • If both the flags were captured at the same time and you have same number of alive minions as your opponent, then you have higher score than your opponent
  • You have more alive minions after 200 turns
  • In case of having same number of alive minions as your opponent after 200 turns, you have higher score.
In case of tie, the game is considered as a draw, with both player being 1st
Defeat Conditions
  • Opponent minion took your flag to their flag-base before your minion captured opponent flag.
  • All your minions die.
  • Your program does not provide a valid command in time.

🐞 Debugging tips

  • Hover over an entity to see extra information about it
  • Press the gear icon on the viewer to access extra display options
  • Use the keyboard to control the action: space to play/pause, arrows to step 1 frame at a time
  • For printing out anything, use stderror

  Action order for one turn

  1. Wait for both players to output commands
  2. Any frozen minions are unfrozen
  3. Flag positions are updated
  4. Minions are moved
  5. Coin positions are updated e.g a coin is removed if it has been taken by a minion
  6. Apply power ups and damage to corresponding minions
  7. Check and detonate mines
  8. Remove dead minions
  9. Decrease minion freeze timeout

  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: myFlagBaseR and myFlagBaseC - the row and column respectively of the cell indicating the flag-base position of the player.
Next line: two integers: opponentFlagBaseR and opponentFlagBaseC - the row and column respectively of the cell indicating the flag-base position of the opponent.
Next 3 lines: powerUpName , powerUpPrice and powerUpDamage
Input for Each Game Turn
Line 1: two integers: myScore and opponentScore - player's and opponent's current score respectively
Line 2: three integers: myFlagPosR, myFlagPosC and myFlagCarrier - player's flag position (row and column respectively) and id of opponent minion who is carrying player's flag (-1 if no minionis carrying)
Line 3: three integers: opponentFlagPosR, opponentFlagPosC and opponentFlagCarrier - opponent's flag position (row and column respectively) and id of player's minion who is carrying opponent's flag (-1 if no minionis carrying)
Line 4: myAliveMinionCnt - number of player's alive minions
Next myAliveMinionCnt lines: id, posR, posC, health, timeout - player's minion's id, position (row and column), health and timeout
Next Line: visibleMinionCnt - number of opponent's visible minions
Next visibleMinionCnt lines: id, posR, posC, health, timeout - opponent's minion's id, position (row and column), health and timeout
Next Line: visibleCoin_cnt - number of coins visible by player's minions
Next visibleCoinCnt lines: posR, posC coin position (row and column)
Output for One Game Turn
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 following the shortest path.
  • FIRE minionID: the minion with the identifier minionID uses FIRE.
  • FREEZE minionID: the minion with the identifier minionID uses FREEZE.
  • MINE minionID r c: the minion with the identifier minionID plants a mine at the cell (r, c) i.e at row r and column c.
  • WAIT minionID: the minion with the identifier minionID does nothing.
You must provide a valid command for atleast one minion each turn, even if all of your minions are currently frozen and timed out.
Constraints
17height20
33width35
3 ≤ Initial minion count ≤ 5
Initial score points for each player = 0
Response time per turn ≤ 50ms
Response time for the first turn ≤ 1000ms