PEP-8 tidiness.
Chris Pressey
3 years ago
52 | 52 | def load_file(self, filename): |
53 | 53 | self.load_string(open(filename, 'r').read()) |
54 | 54 | |
55 | ### helpers ### | |
55 | # ### helpers ### # | |
56 | 56 | |
57 | 57 | def limit(self, x): |
58 | 58 | if x == 2: |
61 | 61 | return 1 |
62 | 62 | return x |
63 | 63 | |
64 | ### instructions ### | |
64 | # ### instructions ### # | |
65 | 65 | |
66 | 66 | def left(self): |
67 | 67 | self.head -= 1 |
105 | 105 | else: |
106 | 106 | raise ValueError("Illegal binary output value '%d'" % val) |
107 | 107 | |
108 | ### execution ### | |
108 | # ### execution ### # | |
109 | 109 | |
110 | 110 | def cycle(self): |
111 | 111 | self.index += 1 |
136 | 136 | self.x += self.dx |
137 | 137 | self.y += self.dy |
138 | 138 | self.dump() |
139 | if (self.x < 0 or self.y < 0 or | |
140 | self.x > self.maxx or self.y > self.maxy): | |
139 | if ( | |
140 | self.x < 0 or self.y < 0 or | |
141 | self.x > self.maxx or self.y > self.maxy | |
142 | ): | |
141 | 143 | break |
142 | 144 | else: |
143 | 145 | table = { |
161 | 163 | self.x += self.dx |
162 | 164 | self.y += self.dy |
163 | 165 | self.dump() |
164 | if (self.x < 0 or self.y < 0 or | |
165 | self.x > self.maxx or self.y > self.maxy): | |
166 | if ( | |
167 | self.x < 0 or self.y < 0 or | |
168 | self.x > self.maxx or self.y > self.maxy | |
169 | ): | |
166 | 170 | break |
167 | 171 | |
168 | ### debugging ### | |
172 | # ### debugging ### # | |
169 | 173 | |
170 | 174 | def dump(self): |
171 | 175 | if not self._debug: |