summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--processbot.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/processbot.py b/processbot.py
index 3bd3038..15e7de0 100644
--- a/processbot.py
+++ b/processbot.py
@@ -1,3 +1,4 @@
+import sys
import subprocess
class BotWrapper(object):
@@ -28,3 +29,25 @@ class BotWrapper(object):
output = proc.stdout.read()
return output.strip()
+def process_input(fp=sys.stdin):
+ width, height, letter = fp.readline().split()
+
+ width = int(width)
+ height = int(height)
+ letter = letter.upper()
+
+ position = None
+
+ board = []
+ for i in xrange(height):
+ row = fp.readline()[:-1]
+ assert len(row) == width
+
+ pos = row.find(letter)
+ if pos >= 0:
+ position = (pos, i)
+
+ board.append(list(row))
+
+ return board, position
+