Commits

Anonymous committed af300e1

pyflakes and pep8 fixes.

  • Participants
  • Parent commits 9eb0201

Comments (0)

Files changed (1)

 
 import sys
 
+
 class Program(object):
     def __init__(self, program, debug=False, super_wimp_mode=False):
         self.wheel = [
         self.dy = 0
 
     ### helpers ###
-    
+
     def limit(self, x):
         if x == 2:
             return -1
         return x
 
     ### instructions ###
-    
+
     def left(self):
         self.head -= 1
 
     def output(self):
         val = self.tape.get(self.head, 0)
         if val == 1:
-            c = sys.stdout.write('1')
+            sys.stdout.write('1')
             sys.stdout.flush()
         elif val == 0:
-            c = sys.stdout.write('0')
+            sys.stdout.write('0')
             sys.stdout.flush()
         else:
             raise ValueError("Illegal binary output value '%d'" % val)
 
     def execute(self):
         name = self.wheel[self.index]
-        self.debug("*                    EXECUTING %s @ (%d,%d)" % (name, self.x, self.y))
+        indent = ' ' * 20
+        self.debug("*%sEXECUTING %s @ (%d,%d)" %
+                   (indent, name, self.x, self.y))
         command = getattr(self, name)
         command()
         self.wheel.pop(self.index)
                 instr = self.playfield.get((self.x, self.y), ' ')
                 name = table.get(instr, None)
                 if name is not None:
-                    self.debug("*                    WIMPZECUTING %s @ (%d,%d)" % (name, self.x, self.y))
+                    indent = ' ' * 20
+                    self.debug("*%sWIMPZECUTING %s @ (%d,%d)" %
+                               (indent, name, self.x, self.y))
                     command = getattr(self, name)
                     command()
                 self.x += self.dx
                     break
 
     ### debugging ###
-    
+
     def dump(self):
         if not self._debug:
             return
                 i += 1
         print "------------"
 
-
     def debug(self, msg):
         if self._debug:
             print msg