(grid)
| 119 | import asyncio |
| 120 | |
| 121 | async def simulate(grid): |
| 122 | next_grid = Grid(grid.height, grid.width) |
| 123 | |
| 124 | tasks = [] |
| 125 | for y in range(grid.height): |
| 126 | for x in range(grid.width): |
| 127 | task = step_cell(y, x, grid.get, next_grid.set) # Fan-out |
| 128 | tasks.append(task) |
| 129 | |
| 130 | await asyncio.gather(*tasks) # Fan-in |
| 131 | |
| 132 | return next_grid |
| 133 | |
| 134 | |
| 135 | print("Example 4") |
no test coverage detected