summaryrefslogtreecommitdiff
path: root/bots.py
diff options
context:
space:
mode:
authorPeter Ward <peteraward@gmail.com>2009-09-28 09:22:31 +1000
committerPeter Ward <peteraward@gmail.com>2009-09-28 09:22:31 +1000
commit997b1a2cf7ff5ee5bdf362e4d06b560ad59be4e6 (patch)
tree2ef82195d143de34ddaee339003f7a94794016c7 /bots.py
Initial commit.
Diffstat (limited to 'bots.py')
-rw-r--r--bots.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bots.py b/bots.py
new file mode 100644
index 0000000..cf23602
--- /dev/null
+++ b/bots.py
@@ -0,0 +1,16 @@
+import random
+
+def random_bot(board, (x, y)):
+ height = len(board)
+ width = len(board[0])
+ moves = []
+ if x > 0:
+ moves.append('L')
+ if x < width - 1:
+ moves.append('R')
+ if y > 0:
+ moves.append('U')
+ if y < height - 1:
+ moves.append('D')
+ return random.choice(moves)
+