Compare commits
No commits in common. "2570974192020c176b848edecae379ba0fdd1826" and "f7571c299c9937f2e93068bb1659cf577e8c4415" have entirely different histories.
2570974192
...
f7571c299c
40
main.py
40
main.py
@ -142,9 +142,6 @@ class Game:
|
|||||||
color = input("Enter player " + str(n + 1) + "'s color: ")
|
color = input("Enter player " + str(n + 1) + "'s color: ")
|
||||||
self.players.append(Player(color))
|
self.players.append(Player(color))
|
||||||
|
|
||||||
# Stickers pools
|
|
||||||
self.stickers = {'White': 0, 'Red': 0, 'Blue': 0, 'Yellow': 0, 'Green': 0, 'Black': 0}
|
|
||||||
|
|
||||||
def getPlayerByColor(self, color):
|
def getPlayerByColor(self, color):
|
||||||
for player in self.players:
|
for player in self.players:
|
||||||
if player.color.lower() == color.lower():
|
if player.color.lower() == color.lower():
|
||||||
@ -178,25 +175,6 @@ class Game:
|
|||||||
input("When you are done, press Enter.")
|
input("When you are done, press Enter.")
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
|
|
||||||
def takeSticker(self, color, nb):
|
|
||||||
if not nb.isdigit() or int(nb) < 1:
|
|
||||||
print("ERROR: Not a positive number")
|
|
||||||
return False
|
|
||||||
nb = int(nb)
|
|
||||||
for c, n in self.stickers.items():
|
|
||||||
if c.lower() == color.lower():
|
|
||||||
if nb > n:
|
|
||||||
print("ERROR: not enough stickers remaining.")
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
self.stickers[c] = n - nb
|
|
||||||
return True
|
|
||||||
print("ERROR: color not found.")
|
|
||||||
return False
|
|
||||||
|
|
||||||
def newStickersBatch(self):
|
|
||||||
self.stickers = {x: self.stickers[x] + 7 for x in self.stickers}
|
|
||||||
|
|
||||||
def printStatus(self):
|
def printStatus(self):
|
||||||
print("")
|
print("")
|
||||||
print("---------------------------------------------------------------------")
|
print("---------------------------------------------------------------------")
|
||||||
@ -213,13 +191,8 @@ class Game:
|
|||||||
print("")
|
print("")
|
||||||
if self.circus.state > 0:
|
if self.circus.state > 0:
|
||||||
print("Circus next sticker color: " + self.circus.getNextColor())
|
print("Circus next sticker color: " + self.circus.getNextColor())
|
||||||
print("")
|
|
||||||
if self.treasure.state > -1:
|
if self.treasure.state > -1:
|
||||||
print(f"Treasures found: {self.treasure.getFoundNumber()}")
|
print(f"Treasures found: {self.treasure.getFoundNumber()}")
|
||||||
print("")
|
|
||||||
print("Road stickers:")
|
|
||||||
for color, nb in self.stickers.items():
|
|
||||||
print(" " + color + ": " + str(nb))
|
|
||||||
|
|
||||||
def saveData(self, path):
|
def saveData(self, path):
|
||||||
savefile = open('./' + path, 'w+')
|
savefile = open('./' + path, 'w+')
|
||||||
@ -251,13 +224,12 @@ elif choice == "load":
|
|||||||
while True:
|
while True:
|
||||||
myGame.printStatus()
|
myGame.printStatus()
|
||||||
command = input("==> ")
|
command = input("==> ")
|
||||||
while command not in ('load', 'save', 'next year', 'exit', 'take sticker', 'batch sticker', 'enable circus',\
|
while command not in ('load', 'save', 'next year', 'exit', 'enable circus', 'take circus', 'enable concession',\
|
||||||
'take circus', 'enable concession', 'take concession', 'disable concession', 'enable treasure', 'take treasure',\
|
'take concession', 'disable concession', 'enable treasure', 'take treasure', 'mama hint 1', 'mama hint 2',\
|
||||||
'mama hint 1', 'mama hint 2', 'mama hint 3', 'mama location'):
|
'mama hint 3', 'mama location'):
|
||||||
print("")
|
print("")
|
||||||
print("Available commands:")
|
print("Available commands:")
|
||||||
print(" Main: 'load', 'save', 'next year', 'exit'")
|
print(" Main: 'load', 'save', 'next year', 'exit'")
|
||||||
print(" Stickers: 'take sticker', 'batch sticker'")
|
|
||||||
print(" Circus: 'enable circus', 'take circus'")
|
print(" Circus: 'enable circus', 'take circus'")
|
||||||
print(" Treasure: 'enable treasure', 'take treasure'")
|
print(" Treasure: 'enable treasure', 'take treasure'")
|
||||||
print(" Concessions: 'enable concession', 'take concession', 'disable concession'")
|
print(" Concessions: 'enable concession', 'take concession', 'disable concession'")
|
||||||
@ -282,12 +254,6 @@ while True:
|
|||||||
myGame.yearId = myGame.yearId + 1
|
myGame.yearId = myGame.yearId + 1
|
||||||
case 'exit':
|
case 'exit':
|
||||||
exit()
|
exit()
|
||||||
case 'take sticker':
|
|
||||||
choice = input("Color ? ==> ")
|
|
||||||
number = input("Nb ? ==> ")
|
|
||||||
myGame.takeSticker(choice, number)
|
|
||||||
case 'batch sticker':
|
|
||||||
myGame.newStickersBatch()
|
|
||||||
case 'enable circus':
|
case 'enable circus':
|
||||||
myGame.circus.enable()
|
myGame.circus.enable()
|
||||||
case 'take circus':
|
case 'take circus':
|
||||||
|
@ -273,3 +273,7 @@ class MamaOConnel:
|
|||||||
if len(cross) > 1: # multiple cities remaining after 3 hints
|
if len(cross) > 1: # multiple cities remaining after 3 hints
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# myMama = MamaOConnel()
|
||||||
|
# while not myMama.solver():
|
||||||
|
# myMama = MamaOConnel()
|
||||||
|
Loading…
Reference in New Issue
Block a user