MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / simulate

Function simulate

example_code/item_075.py:121–132  ·  view source on GitHub ↗
(grid)

Source from the content-addressed store, hash-verified

119import asyncio
120
121async 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
135print("Example 4")

Callers 1

item_075.pyFile · 0.70

Calls 3

GridClass · 0.70
step_cellFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected