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

Method getBoardStr

src/gamesbyexample/tictactoeoop.py:56–66  ·  view source on GitHub ↗

Return a text-representation of the board.

(self)

Source from the content-addressed store, hash-verified

54 self.spaces[space] = BLANK # All spaces start as blank.
55
56 def getBoardStr(self):
57 """Return a text-representation of the board."""
58 return '''
59 {}|{}|{} 1 2 3
60 -+-+-
61 {}|{}|{} 4 5 6
62 -+-+-
63 {}|{}|{} 7 8 9'''.format(self.spaces['1'], self.spaces['2'],
64 self.spaces['3'], self.spaces['4'], self.spaces['5'],
65 self.spaces['6'], self.spaces['7'], self.spaces['8'],
66 self.spaces['9'])
67
68 def isValidSpace(self, space):
69 """Returns True if the space on the board is a valid space

Callers 2

mainFunction · 0.95
getBoardStrMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected