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

Function getNewBoard

src/gamesbyexample/fourinarow.py:54–63  ·  view source on GitHub ↗

Returns a dictionary that represents a Four in a Row board. The keys are (columnIndex, rowIndex) tuples of two integers, and the values are one of the 'X', 'O' or '.' (empty space) strings.

()

Source from the content-addressed store, hash-verified

52
53
54def getNewBoard():
55 """Returns a dictionary that represents a Four in a Row board.
56
57 The keys are (columnIndex, rowIndex) tuples of two integers, and the
58 values are one of the 'X', 'O' or '.' (empty space) strings."""
59 board = {}
60 for columnIndex in range(BOARD_WIDTH):
61 for rowIndex in range(BOARD_HEIGHT):
62 board[(columnIndex, rowIndex)] = EMPTY_SPACE
63 return board
64
65
66def displayBoard(board):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected