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

Function getNewBoard

src/gamesbyexample/mancala.py:73–83  ·  view source on GitHub ↗

Return a dictionary representing a Mancala board in the starting state: 4 seeds in each pit and 0 in the stores.

()

Source from the content-addressed store, hash-verified

71
72
73def getNewBoard():
74 """Return a dictionary representing a Mancala board in the starting
75 state: 4 seeds in each pit and 0 in the stores."""
76
77 # Syntactic sugar - Use a shorter variable name:
78 s = STARTING_NUMBER_OF_SEEDS
79
80 # Create the data structure for the board, with 0 seeds in the
81 # stores and the starting number of seeds in the pits:
82 return {'1': 0, '2': 0, 'A': s, 'B': s, 'C': s, 'D': s, 'E': s,
83 'F': s, 'G': s, 'H': s, 'I': s, 'J': s, 'K': s, 'L': s}
84
85
86def displayBoard(board):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected