It is a dry summer in the prairie. The four farmers in the area realize that they can corner the market on corn by burning their neighbors crops. But they need a strategy for doing so; that is where you come in.
Your task is to write a bot to tell the farmers what to burn. The goal is to finish the game with the largest area of unburnt land. The playing field is a 32x32 grid. Each cell may be one of the following:
. - Ground
@ - A bot
# - Ash
W - Wet ground
1,2,3,4,5, or 6 - Fire
Fire grows in intensity by 1 each turn. Once it is 3 or higher, it will set cells next to it (horizontally or vertically) on fire. After fire hits 6, it turns into ash.
On each turn, bots receive as STDIN the following: bot starting x, bot starting y, bot current x position, bot current y position, and the board, separated by newlines. An example:
8
22
6
24
................................
................................
................................
.....................1..........
....................1#1.........
...................1#363........
....................16@1........
.....................31.........
................................
.........1.1....................
........15#62...................
........15@2....................
.........32.....................
................................
................................
................................
................................
................................
................................
................................
................................
................................
....4.1.........................
.....1#3........................
.....@3.........................
.....W..........................
................................
................................
................................
................................
................................
................................
(in this instance you are the bot in the bottom left).
You must output three characters, with an optional newline, representing the following:
Move - one of L, R, U, D, or S (stay)
Action - one of B (burn), P (pour water) or X (do nothing)
Direction - one of L, R, U, D or S
- controls which cell you perform the action on
Fire does not affect bots.
Turn order is as follows: All bots move; all bots perform actions; then environmental rules happen.
If you pour water on the ground, it will be wet (W
) for one turn. Fire will not spread to wet ground. If you pour water on wet ground, it will continue to be wet. If you pour water on fire, it turns back to regular ground. You cannot do anything to ash.
Rounds are run with 4 bots at a time. The round ends after 50 turns, or when one bot runs out of unburnt ground, whichever comes first. Your score is calculated as the number of ground or wet ground cells in the 9x9 square centered on where your bot started.
Here is an example bot; it picks all three letters randomly and generally ends up burning down its own fields.
RandomBurner:
#!/usr/bin/env python
import random
print random.choice('LRUDS')+random.choice('BPX')+random.choice('LRUDS')
Rules:
- No filesystem access outside of your own folder.
- You may write to files if you need to store persistent data between turns, but only up to a maximum of 1kb per bot
- You may not overwrite anybody else's bot
- If you output an invalid move, your bot will sit still. If you output an invalid action, your bot will do nothing.
- Please stick to common languages that can be run on a OSX or Linux box.
Controller code can be found here.
Initial results:
Average of 15 rounds:
---------------------
81 Farmer
56 CautiousBot
42 GetOff
41 Visigoth
40 DontBurnMeBro
37 FireFighter
35 Pyro
11 Protector
Update: Added Farmer, CautiousBot, GetOff, FireFighter, and Pyro.