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

Function makeMove

src/gamesbyexample/pegsolitaire.py:166–172  ·  view source on GitHub ↗

Carry out the peg move on the given board.

(board, space, direction)

Source from the content-addressed store, hash-verified

164
165
166def makeMove(board, space, direction):
167 """Carry out the peg move on the given board."""
168 nextSpace, secondNextSpace = getNeighboringSpaces(space, direction)
169
170 board[space] = EMPTY # Peg is no longer in this space.
171 board[nextSpace] = EMPTY # Removing the jumped-over peg.
172 board[secondNextSpace] = PEG # The moved peg lands here.
173
174
175def getScore(board):

Callers 1

mainFunction · 0.70

Calls 1

getNeighboringSpacesFunction · 0.85

Tested by

no test coverage detected