summaryrefslogtreecommitdiff
path: root/simple.py
diff options
context:
space:
mode:
authorPeter Ward <peteraward@gmail.com>2014-02-22 20:22:46 +1100
committerPeter Ward <peteraward@gmail.com>2014-02-22 20:22:46 +1100
commit342bdfdc64e0b7e1874e6e9280e1a2475cc6b8bb (patch)
treeb9f6c85c8af7e999deff587c3dcf5dd293186d07 /simple.py
initial version
Diffstat (limited to 'simple.py')
-rw-r--r--simple.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/simple.py b/simple.py
new file mode 100644
index 0000000..faeb366
--- /dev/null
+++ b/simple.py
@@ -0,0 +1,18 @@
+import random
+import robots
+
+def bot(whoami, players, board):
+ my_robots = players[whoami]['robots']
+ action = random.choice('UDLRP-')
+ return action * len(my_robots)
+
+if __name__ == '__main__':
+ random.seed(64)
+ map_ = robots.empty_map(20, 20, 4)
+ game = robots.Game(map_)
+ game.add_bot(bot, 'Alice')
+ game.add_bot(bot, 'Bob')
+ game.add_bot(bot, 'Charlie')
+ game.add_bot(bot, 'Doug')
+ viewer = robots.CursesViewer(game)
+ viewer.run()