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

Function drawMower

src/gamesbyexample/lawnmower.py:113–125  ·  view source on GitHub ↗

Draw the lawn mower with its left edge at mowerx, mowery.

(mowerx, mowery, direction)

Source from the content-addressed store, hash-verified

111
112
113def drawMower(mowerx, mowery, direction):
114 """Draw the lawn mower with its left edge at mowerx, mowery."""
115 bext.fg('red')
116 if direction == 'right':
117 mowerText = MOWER_RIGHT
118 elif direction == 'left':
119 mowerText = MOWER_LEFT
120
121 for i in range(MOWER_LEN):
122 if 0 <= mowerx + i < WIDTH:
123 bext.goto(mowerx + i, mowery)
124 print(mowerText[i], end='')
125 bext.goto(0, 0) # It looks better to move the cursor away.
126
127
128# If this program was run (instead of imported), run the game:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected