King of the Hill - Firefighters 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.
Visigoth

Visigoth tries to burn its enemies to the ground. It hopes to do this before anyone else gets to its land.

Run: python visigoth.py

#!/usr/bin/python

''' Charge the enemy and burn them to the ground. '''

import sys

data = sys.stdin.readlines()

startx, starty, x, y = [int(i) for i in data[0:4]]
field = [list(i) for i in data[4:]]

otherbots = []
for i in range(32):
    for j in range(32):
        if field[i][j]=='@': #bot
            if i!=y and j!=x:
                otherbots.append([j,i])

min_bot = otherbots[0]
for bot in otherbots:
    if abs(bot[0]-x)+abs(bot[1]-y) &lt; abs(min_bot[0]-x)+abs(min_bot[1]-y):
        min_bot = bot

dx = min_bot[0]-x
dy = min_bot[1]-y

if abs(dy)&gt;abs(dx):
    if dy&gt;0:
        move = 'U'
    else:
        move = 'D'
else:
    if dx&gt;0:
        move = 'R'
    elif dx&lt;0:
        move = 'L'
    else:
        move = 'S'

if max(abs(x-startx), abs(y-starty))&gt;4:
    if 0&lt;x&lt;31 and 0&lt;y&lt;31:
        dirs = {'U':(-1,0), 'D':(1,0), 'L':(0,-1), 'R':(0,1)}
        for i in dirs:
            if field[dirs[i][0]][dirs[i][1]] in ('.', 'W'):
                action = 'B'+i
                break
        else:
            # No free land nearby, go out in a blaze of glory
            action = 'BS'
    else:
        action = 'BS'
else:
    # Don't set own field on fire
    action = 'XS'

print move+action


This is my first entry, constructive criticism is appreciated!