F. Fungus (3000 points)

The Game

So it happened that one of the organizers accidentally kicked a pile of discarded petri dishes. The virulent strains of fungi that before occupied the fetid creases of his foot have been released into the nutritious gelatin. They are now engaged in a biological fight to the death.

Your team now has the opportunity to control one of these strains and prove its genetic superiority.

Rules

The map is built from rectangular cells with X;Y coordinates (0 <= X < W, 0 <= Y < H). On each cell there may be a stack of food or a stack of fungi of a team (different teams have different type of fungi). A team may command fungi to move to an adjecent cell.

For each tick, moves of a single team are processed. 30 ticks (one for each team) forms a round. Teams may place commands any time, but only the last 500 commands will be considered (in case of multiple commands for the same cell, only the last one will run). Invalid commands are ignored, all valid commands run in "parallel" (one set of fungi will move only once).

After each such move, the new standing is broadcasted to all teams (only diff).

Before the beginning of the game, the original map is published.

Scores are calculated at end of each game for every team in the following way:

Map format

At the beginning of each game, a PNG image is published on web at https://10.0.0.1/fungus. The size of the PNG image determines W and H. The top-left corner of the image has coordinates 0;0. The top-right corner of the image has coordinates W-1;0. Cells outside the map have RGB color 0,0,0 (black). Initially there is no cell with more than 15 fungi or more than 15 food on it. Cells inside the map have two types:

Team numberTeam nameReference color (A,B,C)
1rusty1,0,0
2Grotzsch_Men1,0.33,0
3Sparrows241,0.67,0
4The_Teddyborg1,1,0
5SRM0.67,1,0
6Saratov.SU2.Retired0.33,1,0
7BasicInstincts0,1,0
8UPC-Unflapipes0,1,0.33
9DrinkLess0.33,1,0.33
10croSharks0.67,1,0.33
11OrelSTU1,1,0.33
12pda1,0.67,0.33
13UPC-Siesqueva1,0.33,0.33
14Monkey_Island1,0.33,0.67
15ETs1,0.33,1
16Room_1010.67,0.33,1
17Eventually_almost_surely_correct0.33,0.33,1
18O.o0.33,0.67,1
19WarsawEaters0.33,1,1
20uw30000.33,1,0.67
21funny-noise0,1,0.67
22Scorpions0,1,1
23Nemterminisztikus_fogoritmus0,0.67,1
24DTA0,0.33,1
25UPC-Reisub0,0,1
26Jackhammer0.33,0,1
27Raf0.67,0,1
28balloonsRus1,0,1
29groundwater1,0,0.67
30WeKings_SB_Forever1,0,0.33

Communication protocol

Each command consists of coordinates of a cell, 4 numbers of fungi to move in each direction. Each command is in a new line, the six numbers are separated by spaces. For example:

6 3 14 0 1 3\n

this means: from cell 6;3, move 14 fungi to north, 0 to east, 1 fungus to south and 3 to west. If there are not enough fungi on the cell to do all 4 operations, none of the operations will be done and the command will be considered invalid. If any of the 4 operation is invalid then the whole command is invalid too.

The server may send the following:

The game starts in sec seconds.

The now-th round is starting.

Team with number teamnum is coming.

The cell with x;y coordinates has a stack of height fungi of team owner. If owner == 0 then it has a stack of height food.

Schedule

Each game has 500 rounds, each tick lasts 0.2 sec, so a game lasts totally 500*30*0.2 sec = 50 min. The server is started and the initial map is published at every hour. Five minutes later the game begins. It ends at 55 minutes after the hour. Then the score is calculated and there is a 5 minute break before the next server is started.