| 54 | |
| 55 | print("Example 2") |
| 56 | class Grid: |
| 57 | def __init__(self, height, width): |
| 58 | self.height = height |
| 59 | self.width = width |
| 60 | self.rows = [] |
| 61 | for _ in range(self.height): |
| 62 | self.rows.append([EMPTY] * self.width) |
| 63 | |
| 64 | def get(self, y, x): |
| 65 | return self.rows[y % self.height][x % self.width] |
| 66 | |
| 67 | def set(self, y, x, state): |
| 68 | self.rows[y % self.height][x % self.width] = state |
| 69 | |
| 70 | def __str__(self): |
| 71 | output = "" |
| 72 | for row in self.rows: |
| 73 | for cell in row: |
| 74 | output += cell |
| 75 | output += "\n" |
| 76 | return output |
| 77 | |
| 78 | |
| 79 | print("Example 3") |
no outgoing calls
no test coverage detected