()
| 51 | |
| 52 | |
| 53 | def main(): |
| 54 | theFloor = getNewFloor() |
| 55 | paintedAreas = set() |
| 56 | |
| 57 | # Generate painters: |
| 58 | painters = [] |
| 59 | for color in THE_PAINTERS: |
| 60 | painters.append(Painter(color, theFloor)) |
| 61 | |
| 62 | bext.fg('black') |
| 63 | bext.clear() |
| 64 | while True: # Main simulation loop. |
| 65 | for painter in painters: |
| 66 | # Keep track of the painted floors: |
| 67 | paintedAreas.add((painter.x, painter.y)) |
| 68 | if len(paintedAreas) == WIDTH * HEIGHT: |
| 69 | # Move the text cursor to the bottom right so that |
| 70 | # new text doesn't overwrite our painting. |
| 71 | bext.goto(bext.width() - 1, bext.height() - 1) |
| 72 | print() # Print a newline. |
| 73 | print('Seed: {} Width: {} Height: {}'.format(SEED, |
| 74 | (WIDTH + 1) * 2, HEIGHT)) |
| 75 | sys.exit() # The floor is completely painted, so quit. |
| 76 | |
| 77 | painter.move() |
| 78 | |
| 79 | sys.stdout.flush() |
| 80 | time.sleep(PAUSE_LENGTH) |
| 81 | |
| 82 | |
| 83 | def getNewFloor(): |
no test coverage detected