Beispiel #1
0
	def gameSelect(self):
		self.__yahtzee= Yahtzee(self.__player)
		self.__slots = SlotMachine(self.__player)
		choice = ""
		game1 = "Slot Machine"
		game2 = "Yahtzee"
		while True:
			print("Hello " + self.__player.getName())
			print("Balance: $%.2f" % self.__player.getCurrentWallet())
			print("What game would you like to play?")
			choice = input()
			print(choice)
			if choice == game1.lower() or choice == game1.upper() or choice == game1:
				self.__slots.run()
				self.gameList()
			elif choice == game2.lower() or choice == game2.upper() or choice ==game2:
				self.__yahtzee.run()
				self.gameList()

			elif choice == "q" or choice == "quit":
				print("Thank you for playing Casino Suite\n")
				exit()
			else:
					print("I'm sorry, I did not recognize that game. Please select from the list")
					print("Or if you wish to quit, type 'q' or 'quit'")
Beispiel #2
0
class MainMenu:
	__yahtzee = None
	__slots = None
	__player = None
	__color = None

	#Main Start fucntion for MainMenu.
	def run(self):
		self.printTitle()
		self.__player = User(self.startMoney(),self.newPlayer())
		self.gameList()
		self.gameSelect()
		#End Main run function

	#Displays Opening Title Header.
	def printTitle(self):
		print("**************************************************")
		print("**           Welcome to Casino Suite!           **")
		print("**************************************************")
		#End printTitle Function

	def newPlayer(self):
		playerName=""
		while True:
			print("What is your name?")
			playerName = input()
			if  playerName.replace(' ',' ').isalpha():
				break
			else:
				print("Player name can only contain characters\n")
		return playerName
		#End New Player Function

	def startMoney(self):
		dollars = 0.00
		print("How much money will you be starting off with for games?")
		flag = True;
		while flag:
			try:
				dollars = float(input())
				flag = False;
			except ValueError:
				print(dollars);
				print("Please enter a number only.")
		return dollars
		#End StartMoney Function

	#Displays the list of all games that can be played
	def gameList(self):
		#Title header
		print("**************************************************")
		print("**                 Casino Suite                 **")
		print("**                  Games List                  **")
		print("**************************************************")

		#List of games
		print("^^^^^^^^^           Slot Machine         ^^^^^^^^^")
		print("^^^^^^^^^             Yahtzee            ^^^^^^^^^")
		print("**************************************************")
		#End Game List Fucntion

	def gameSelect(self):
		self.__yahtzee= Yahtzee(self.__player)
		self.__slots = SlotMachine(self.__player)
		choice = ""
		game1 = "Slot Machine"
		game2 = "Yahtzee"
		while True:
			print("Hello " + self.__player.getName())
			print("Balance: $%.2f" % self.__player.getCurrentWallet())
			print("What game would you like to play?")
			choice = input()
			print(choice)
			if choice == game1.lower() or choice == game1.upper() or choice == game1:
				self.__slots.run()
				self.gameList()
			elif choice == game2.lower() or choice == game2.upper() or choice ==game2:
				self.__yahtzee.run()
				self.gameList()

			elif choice == "q" or choice == "quit":
				print("Thank you for playing Casino Suite\n")
				exit()
			else:
					print("I'm sorry, I did not recognize that game. Please select from the list")
					print("Or if you wish to quit, type 'q' or 'quit'")