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

Function displayBoard

src/gamesbyexample/gomoku.py:70–84  ·  view source on GitHub ↗

Display the board data structure on the screen.

(board)

Source from the content-addressed store, hash-verified

68
69
70def displayBoard(board):
71 """Display the board data structure on the screen."""
72 displayLetterLabels() # Display the letter labels at the top.
73
74 # Display each board row:
75 for y in range(BOARD_HEIGHT):
76 # Display the leftside number label:
77 print(str(y + 1).rjust(2) + ' ', end='')
78 for x in range(BOARD_WIDTH):
79 # Display each tile in this row, followed by a space:
80 print(board[(x, y)] + ' ', end='')
81 # Display the rightside number label:
82 print(y + 1)
83
84 displayLetterLabels() # Display the letter labels at the bottom.
85
86
87def displayLetterLabels():

Callers 1

mainFunction · 0.70

Calls 1

displayLetterLabelsFunction · 0.85

Tested by

no test coverage detected