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

Method moveNorth

src/gamesbyexample/slitheringsnakes.py:90–96  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

88 x, y = getRandomNeighbor(x, y)
89
90 def moveNorth(self):
91 headx, heady = self.body[0]
92 if self.isBlocked(NORTH):
93 return False
94 self.body.insert(0, (headx, heady - 1))
95 self._eraseLastBodySegment()
96 return True
97
98 def moveSouth(self):
99 headx, heady = self.body[0]

Callers 1

moveRandomMethod · 0.95

Calls 2

isBlockedMethod · 0.95
_eraseLastBodySegmentMethod · 0.95

Tested by

no test coverage detected