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

Function displayBoard

src/gamesbyexample/reversegam.py:152–167  ·  view source on GitHub ↗

Displays the board data structure passed to this function.

(board)

Source from the content-addressed store, hash-verified

150
151
152def displayBoard(board):
153 """Displays the board data structure passed to this function."""
154
155 print(' ABCDEFGH')
156 print(' +--------+')
157 for y in range(8):
158 print('{}|'.format((y + 1)), end='') # Display the row number.
159 for x in range(8):
160 print(board[(x, y)], end='') # Display the row.
161 print('|{}'.format((y + 1))) # Display the row number.
162 print(' +--------+')
163 print(' ABCDEFGH')
164
165 # Prints out the current score.
166 scores = getScoreOfBoard(board)
167 print('X: {} points, O: {} points'.format(scores['X'], scores['O']))
168
169
170def getScoreOfBoard(board):

Callers 1

mainFunction · 0.70

Calls 1

getScoreOfBoardFunction · 0.70

Tested by

no test coverage detected