summaryrefslogtreecommitdiff
path: root/oldbot.py
diff options
context:
space:
mode:
authorPeter Ward <pwar3236@usyd.edu.au>2010-01-05 06:56:13 +1100
committerPeter Ward <pwar3236@usyd.edu.au>2010-01-05 06:56:13 +1100
commitf788bdcf63d14dd97f0802391b0676ca84c900ce (patch)
tree9d98fbf8ef0ab30ee573fadf9eeff4cf723feb25 /oldbot.py
parent62527ef65ec78124f97426ba1e7f44fafe1be134 (diff)
Renamed old bots to process bots.
Diffstat (limited to 'oldbot.py')
-rw-r--r--oldbot.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/oldbot.py b/oldbot.py
deleted file mode 100644
index 3bd3038..0000000
--- a/oldbot.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import subprocess
-
-class BotWrapper(object):
- def __init__(self, process):
- self.process = process
- self.__name__ = process
-
- def __call__(self, board, (x, y)):
- height = len(board)
- width = len(board[0])
-
- letter = board[y][x].lower()
-
- proc = subprocess.Popen(
- [self.process],
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- )
-
- board = '\n'.join([''.join(row) for row in board])
-
- print>>proc.stdin, width, height, letter
- print>>proc.stdin, board
- proc.stdin.close()
- proc.wait()
-
- assert proc.returncode == 0, 'Snake died.'
- output = proc.stdout.read()
- return output.strip()
-