MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / displayFireflies

Function displayFireflies

src/gamesbyexample/fireflies.py:178–189  ·  view source on GitHub ↗
(lightPoints, darkPoints)

Source from the content-addressed store, hash-verified

176
177
178def displayFireflies(lightPoints, darkPoints):
179 # Loop over every place on the screen and draw fireflies:
180 for y in range(HEIGHT):
181 for x in range(WIDTH):
182 if (x, y) in lightPoints:
183 print(FIREFLY_LIGHT, end='') # Display lit firefly.
184 elif (x, y) in darkPoints:
185 print(FIREFLY_DARK, end='') # Display dark firefly.
186 else:
187 print(' ', end='') # Display an empty space.
188 print() # Print a newline.
189 print('Press Ctrl-C to quit.', end='', flush=True)
190
191
192def clearScreen():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected