Add interface for MOC tracking
This commit is contained in:
parent
507ef83607
commit
acd669ba34
38
main.py
38
main.py
@ -4,7 +4,7 @@
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import jsonpickle
|
import jsonpickle
|
||||||
import time
|
from src.MamaOConnel import MamaOConnel
|
||||||
|
|
||||||
class Circus:
|
class Circus:
|
||||||
# There are:
|
# There are:
|
||||||
@ -131,8 +131,10 @@ class Game:
|
|||||||
|
|
||||||
# General data to generate
|
# General data to generate
|
||||||
self.circus = Circus(playersNb)
|
self.circus = Circus(playersNb)
|
||||||
# Mama O'Connell
|
|
||||||
self.treasure = TreasureCard()
|
self.treasure = TreasureCard()
|
||||||
|
self.mamaoc = MamaOConnel()
|
||||||
|
while not self.mamaoc.solver():
|
||||||
|
self.mamaoc = MamaOConnel()
|
||||||
|
|
||||||
# Players
|
# Players
|
||||||
self.players = []
|
self.players = []
|
||||||
@ -153,6 +155,26 @@ class Game:
|
|||||||
def disableConcession(self):
|
def disableConcession(self):
|
||||||
self.concession = False
|
self.concession = False
|
||||||
|
|
||||||
|
# if number = 0 print Mama O'Connel's location, else print hint #number
|
||||||
|
def printMamaHint(self, number):
|
||||||
|
if number not in range(0, 4):
|
||||||
|
return False
|
||||||
|
os.system('clear')
|
||||||
|
input("When you are ready, press Enter.")
|
||||||
|
print("")
|
||||||
|
match number:
|
||||||
|
case 0:
|
||||||
|
print("Mama O'Connel is at: " + self.mamaoc.location.name)
|
||||||
|
case 1:
|
||||||
|
print("Mama O'Connel is " + str(self.mamaoc.hint1[1]) + " cities from " + self.mamaoc.hint1[0].name)
|
||||||
|
case 2:
|
||||||
|
print("Mama O'Connel is " + str(self.mamaoc.hint2[1]) + " cities from " + self.mamaoc.hint2[0].name)
|
||||||
|
case 3:
|
||||||
|
print("Mama O'Connel is " + str(self.mamaoc.hint3[1]) + " cities from " + self.mamaoc.hint3[0].name)
|
||||||
|
print("")
|
||||||
|
input("When you are done, press Enter.")
|
||||||
|
os.system('clear')
|
||||||
|
|
||||||
def printStatus(self):
|
def printStatus(self):
|
||||||
print("")
|
print("")
|
||||||
print("---------------------------------------------------------------------")
|
print("---------------------------------------------------------------------")
|
||||||
@ -203,13 +225,15 @@ while True:
|
|||||||
myGame.printStatus()
|
myGame.printStatus()
|
||||||
command = input("==> ")
|
command = input("==> ")
|
||||||
while command not in ('load', 'save', 'next year', 'exit', 'enable circus', 'take circus', 'enable concession',\
|
while command not in ('load', 'save', 'next year', 'exit', 'enable circus', '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 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(" 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'")
|
||||||
|
print(" Mama O'Connel tracking: 'mama hint 1', 'mama hint 2', 'mama hint 3', 'mama location'")
|
||||||
command = input("==> ")
|
command = input("==> ")
|
||||||
print("")
|
print("")
|
||||||
match command:
|
match command:
|
||||||
@ -251,3 +275,11 @@ while True:
|
|||||||
player.concession.takeReward(choice)
|
player.concession.takeReward(choice)
|
||||||
case 'disable concession':
|
case 'disable concession':
|
||||||
myGame.disableConcession()
|
myGame.disableConcession()
|
||||||
|
case 'mama hint 1':
|
||||||
|
myGame.printMamaHint(1)
|
||||||
|
case 'mama hint 2':
|
||||||
|
myGame.printMamaHint(2)
|
||||||
|
case 'mama hint 3':
|
||||||
|
myGame.printMamaHint(3)
|
||||||
|
case 'mama location':
|
||||||
|
myGame.printMamaHint(0)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
class City:
|
class City:
|
||||||
@ -275,6 +274,6 @@ class MamaOConnel:
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
myMama = MamaOConnel()
|
# myMama = MamaOConnel()
|
||||||
while not myMama.solver():
|
# while not myMama.solver():
|
||||||
myMama = MamaOConnel()
|
# myMama = MamaOConnel()
|
Loading…
Reference in New Issue
Block a user