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

Function printField

inprogress/floodfill.py:99–116  ·  view source on GitHub ↗
(field)

Source from the content-addressed store, hash-verified

97
98
99def printField(field):
100 # Display the field data structure on the screen:
101
102 # Display the x coordinates along the top:
103 print(' ', end='')
104 for i in range(WIDTH // 10):
105 print(str(i) + NINE_SPACES, end='')
106 print()
107 print(' ' + ('0123456789' * 10)[:WIDTH])
108
109 # Print the characters in the field:
110 for y in range(HEIGHT):
111 # Print each row, including the y coordinates on the left side:
112 print(str(y).rjust(2) + ' ', end='')
113 for x in range(WIDTH):
114 # Print each character:
115 print(field[(x, y)], end='')
116 print() # Print a newline at the end of the row.
117
118
119print('''FLOODFILL

Callers 1

floodfill.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected