Update method names to better match what they do

This commit is contained in:
Alexandre CATTEAU 2024-05-06 10:07:22 +02:00
parent 1e3b96e689
commit d2a58a0392

View File

@ -33,7 +33,7 @@ class Circus:
def getNextColor(self):
return self.wagons[self.state - 1]
def getWagon(self):
def takeWagon(self):
if self.state == 0:
print("Circus is not or no longer in game.")
return False
@ -63,15 +63,15 @@ class ConcessionCard: # name may be different in English
def getRemainingPepites(self):
return {1, 2, 3, 4, 5, 6, 7} - self.taken
def getReward(self, choice):
def takeReward(self, choice):
if choice in self.taken:
print(str(choice) + " has already been obtained.")
return False
self.taken.add(choice)
print("Congrats! You obtained $" + str(self.pepites[choice]))
return True
class Player:
def __init__(self, color):
self.color = color
self.concession = ConcessionCard()
@ -140,11 +140,11 @@ playersNb = 2
# cc = ConcessionCard()
# userChoice = 3
# print(cc.pepites)
# cc.getReward(userChoice - 1)
# cc.takeReward(userChoice - 1)
# print(cc.pepites)
# print(cc.taken)
# print("Remaining: " + str(cc.getRemainingPepites()))
# cc.getReward(userChoice - 1)
# cc.takeReward(userChoice - 1)
# print(cc.pepites)
# print(cc.taken)
# print("Remaining: " + str(cc.getRemainingPepites()))
@ -153,8 +153,6 @@ playersNb = 2
myGame = Game()
myGame.initGame(playersNb)
myGame.printStatus()
myGame.concession = True
myGame.printStatus()
myGame.circus.enable()
myGame.printStatus()
print(myGame.circus.wagons)