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

Method _generateRandom

inprogress/dropspin.py:118–125  ·  view source on GitHub ↗
(self, steps=100)

Source from the content-addressed store, hash-verified

116
117
118 def _generateRandom(self, steps=100):
119 for i in range(steps):
120 if random.randint(1, 5) == 1:
121 self.rotateLeft()
122 elif random.randint(1, 5) == 1:
123 self.rotateRight()
124 else:
125 self.dropOnColumn(random.randint(0, self.size - 1))
126
127 def rememberBoard(self):
128 self.moves.append(copy.copy(self.board))

Callers 1

dropspin.pyFile · 0.80

Calls 3

rotateLeftMethod · 0.95
rotateRightMethod · 0.95
dropOnColumnMethod · 0.95

Tested by

no test coverage detected