summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Ward <peteraward@gmail.com>2009-10-02 13:24:18 +1000
committerPeter Ward <peteraward@gmail.com>2009-10-02 13:24:18 +1000
commit44a032e636d93e44a931a31e4e0f0ab7458fb465 (patch)
tree956cc457dccfc6f9fc427d057699259632200b2d
parent986964a1a7940e98bd1746d67fbd836986c8aee3 (diff)
Made template file.
-rw-r--r--peter.py11
-rw-r--r--template.py15
2 files changed, 15 insertions, 11 deletions
diff --git a/peter.py b/peter.py
deleted file mode 100644
index dd3920b..0000000
--- a/peter.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from pyglet_snake import PygletSnakeEngine
-
-def my_bot(board, position):
- x, y = position
- print board[y][x]
- return 'U'
-
-p = PygletSnakeEngine(25, 25, 10)
-p.add_bot(my_bot)
-p.run()
-
diff --git a/template.py b/template.py
new file mode 100644
index 0000000..194b1a5
--- /dev/null
+++ b/template.py
@@ -0,0 +1,15 @@
+from pyglet_snake import PygletSnakeEngine
+
+def your_name_here_bot(board, position):
+ x, y = position
+ mychar = board[y][x]
+ return 'U'
+
+# Test code to run the snake game.
+# Leave the if statement as is, otherwise I won't be able to run your bot with
+# the other bots.
+if __name__ == '__main__':
+ p = PygletSnakeEngine(25, 25, 10)
+ p.add_bot(your_name_here_bot)
+ p.run()
+