MCPcopy Create free account
hub / github.com/ActiveState/code / getNextTurn

Method getNextTurn

recipes/Python/580811_Uno_TextBased/recipe-580811.py:1302–1317  ·  view source on GitHub ↗
(self, forceReverse=False)

Source from the content-addressed store, hash-verified

1300 self.turn = self.getNextTurn()
1301
1302 def getNextTurn(self, forceReverse=False):
1303 if forceReverse:
1304 reverse = not self.reverse
1305 else:
1306 reverse = self.reverse
1307 currentIndex = self.turnList.index(self.turn)
1308 if not reverse:
1309 if (currentIndex + 1) == len(self.turnList):
1310 return self.turnList[0]
1311 else:
1312 return self.turnList[currentIndex+1]
1313 else:
1314 if currentIndex == 0:
1315 return self.turnList[len(self.turnList) - 1]
1316 else:
1317 return self.turnList[currentIndex-1]
1318
1319 def getPlayer(self, playerID):
1320 return self.players[playerID]

Callers 3

nextTurnMethod · 0.95
nextMethod · 0.95
thinkMethod · 0.80

Calls 1

indexMethod · 0.45

Tested by

no test coverage detected