def Hit():
			if GameLogic.cardTotal > 21 or GameLogic.funds <= 0:
				GameLogic.box.showinfo('Lost', 'You have lost the game.\nPlease choose New from File menu')
			else: 
				print('Dealer deals new card')
				suit = GameLogic.GetSuit()
				rank = GameLogic.GetRank()
				lblStr = rank + ' of ' + suit
				print(GameLogic.cardTotal)
				isMatch = GameLogic.CheckHand(lblStr, self.cardManager.GetCards())
				while isMatch == 'match':
					suit = GameLogic.GetSuit()
					rank = GameLogic.GetRank()
					lblStr = rank + ' of ' + suit
					isMatch = GameLogic.CheckHand(lblStr, self.cardManager.GetCards())

				if rank == 'Ace':
					if 11 + GameLogic.cardTotal > 21:
						GameLogic.cardTotal += 1
					else:
						GameLogic.cardTotal += 11
				else:
					GameLogic.cardTotal += GameLogic.GetRankNum(rank)
				
				self.cardManager.SetNextCard(lblStr)
				if GameLogic.isOver(GameLogic.cardTotal) == 'true':
					GameLogic.box.showinfo('Lost', 'You have lost the game.\nPress NEW ROUND to play again')
					GameLogic.funds -= 50
					self.SetLabel()
				elif GameLogic.cardTotal == 21:
					GameLogic.box.showinfo('WIN!!!!!', 'You have WON the game!!!!')
					GameLogic.funds += 100
					self.SetLabel()
Esempio n. 2
0
 def Hit():
     print('Dealer deals new card')
     suit = GameLogic.GetSuit()
     rank = GameLogic.GetRank()
     lblStr = rank + ' of ' + suit
     print(lblStr)
     label.config(text=lblStr)  #Change text
Esempio n. 3
0
    def SetFirstTwo(self):
        i = 0
        while i < 2:
            suit = GameLogic.GetSuit()
            rank = GameLogic.GetRank()
            lblStr = rank + ' of ' + suit
            isMatch = GameLogic.CheckHand(lblStr, self.cards)
            while isMatch == 'match':
                suit = GameLogic.GetSuit()
                rank = GameLogic.GetRank()
                lblStr = rank + ' of ' + suit
                isMatch = GameLogic.CheckHand(lblStr, self.cards)

            self.SetNextCard(lblStr)
            if rank == 'Ace':
                if 11 + GameLogic.cardTotal > 21:
                    GameLogic.cardTotal += 1
                else:
                    GameLogic.cardTotal += 11
            else:
                GameLogic.cardTotal += GameLogic.GetRankNum(rank)
            i += 1