()
| 58 | |
| 59 | |
| 60 | def main(): |
| 61 | global FISHES, BUBBLERS, BUBBLES, KELPS, STEP |
| 62 | bext.bg('black') |
| 63 | bext.clear() |
| 64 | |
| 65 | # Generate the global variables: |
| 66 | FISHES = [] |
| 67 | for i in range(NUM_FISH): |
| 68 | FISHES.append(generateFish()) |
| 69 | |
| 70 | # NOTE: Bubbles are drawn, but not the bubblers themselves. |
| 71 | BUBBLERS = [] |
| 72 | for i in range(NUM_BUBBLERS): |
| 73 | # Each bubbler starts at a random position. |
| 74 | BUBBLERS.append(random.randint(LEFT_EDGE, RIGHT_EDGE)) |
| 75 | BUBBLES = [] |
| 76 | |
| 77 | KELPS = [] |
| 78 | for i in range(NUM_KELP): |
| 79 | kelpx = random.randint(LEFT_EDGE, RIGHT_EDGE) |
| 80 | kelp = {'x': kelpx, 'segments': []} |
| 81 | # Generate each segment of the kelp: |
| 82 | for i in range(random.randint(6, HEIGHT - 1)): |
| 83 | kelp['segments'].append(random.choice(['(', ')'])) |
| 84 | KELPS.append(kelp) |
| 85 | |
| 86 | # Run the simulation: |
| 87 | STEP = 1 |
| 88 | while True: |
| 89 | simulateAquarium() |
| 90 | drawAquarium() |
| 91 | time.sleep(1 / FRAMES_PER_SECOND) |
| 92 | clearAquarium() |
| 93 | STEP += 1 |
| 94 | |
| 95 | |
| 96 | def getRandomColor(): |
no test coverage detected