A cell is either a safe cell or a tree cell or a house cell.
All tree and house cells have three parameters:
- fireDuration:
number of turns a cell remains on fire before propagating into the adjacent cells.
- cutDuration:
number of turns needed to make the cell safe.
- value:
score represented by this cell and lost if this cell is burnt or cut.
These three parameters are the same for each "tree" cells and the same for each "house" cells.
You are given these parameters (6 values), the size of the map, the starting cell of the fire, and finally the type of each cell of the map.
By blocking the spreading fire, you must save as much value as you can.
Spread of fire
A cell in fire stays in fire during
fireDuration turns.
Each cell has a
fireProgress incremented each turns.
Once this
fireProgress reaches
fireDuration, the tile is considered as burnt and propagates into the four adjacent cells (North, South, East, West) if they are not safe and not burnt (with
fireProgress ==
-1).
Block the spreading fire
You can cut cells to make them safe and block the spreading of the fire. When you cut a cell, a
cooldown is set to the
cutDuration of the cell. It will decrease during the next turns until it reaches 0. While the
cooldown is non zero, you may not give another cell to cut.
You cannot cut cells which are safe (it would be useless) and cells which are on fire (or you will burn with the cell). Otherwise the game will end. Also, a cell is considered safe as soon as you start to cut it. That is, a fire in an adjacent cell cannot spread into the cell where you already are.
Score evaluation
It is an optimization game. So your goal is to keep as much value as possible.
The score for a test is the sum of the value of cells which were not burnt or cut.
The score for this game is the sum of the score for each test.
Note: Tests cannot fail.
Doing nothing will simply result in a score of 0.
If a test is ended because of a timeout or a bad output,
the game will compute the spreading of the remaining fire (if any) for the final score.