Lars Yencken avatar Lars Yencken committed 0ef45f0

Revert earlier change which broke the input loop.

Comments (0)

Files changed (1)

             tmp += '# %s\n' % ''.join([MAP_RENDER[col] for col in row])
         return tmp
 
-    # static methods are not tied to a class and don't have self passed in
-    # this is a python decorator
     @staticmethod
     def run(bot, istream=sys.stdin):
         'parse input, update game state and call the bot classes do_turn method'
         map_data = ''
         while(True):
             try:
-                current_line = istream.next().rstrip('\r\n') # string new line char
+                current_line = istream.readline().rstrip('\r\n')
                 if current_line.lower() == 'ready':
                     ants.setup(map_data)
                     bot.do_setup(ants)
                     map_data = ''
                 else:
                     map_data += current_line + '\n'
-            except StopIteration:
+            except EOFError:
                 break
             except KeyboardInterrupt:
                 raise
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.