home · contact · privacy
Refactor parser code.
[plomrogue2] / plomrogue / io.py
index 438b8b6e1301e4da584127382629791ce87756b6..490706eefd9fe2ef203632dd6b255180839fd252 100644 (file)
@@ -13,6 +13,18 @@ class GameIO():
         self.save_file = save_file
         self.servers = []
 
+    def train_parser(self):
+        import string
+        self.parser.string_options = {
+            'map_geometry': {'Hex', 'Square'},
+            'char': [c for c in
+                     string.digits + string.ascii_letters + string.punctuation
+                     + ' '],
+            'direction': self.game.map_geometry.directions,
+            'direction+here': ['HERE'] + self.game.map_geometry.directions,
+            'thing_type': self.game.thing_types.keys()
+        }
+
     def loop(self, q):
         """Handle commands coming through queue q, run game, send results back.