generated from mwc/lab_dice
	I changed some code such as rolls and other things..
This commit is contained in:
		@@ -20,8 +20,8 @@ class FiveDice:
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
dice = FiveDice()
 | 
			
		||||
successes = 0
 | 
			
		||||
trials = 1000000
 | 
			
		||||
successes = 3
 | 
			
		||||
trials = 10
 | 
			
		||||
for trial in tqdm(range(trials)):
 | 
			
		||||
    dice.roll()
 | 
			
		||||
    if dice.all_ones():
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								die.py
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								die.py
									
									
									
									
									
								
							@@ -15,3 +15,4 @@ class Die:
 | 
			
		||||
    def roll(self):
 | 
			
		||||
        self.face = randint(1, 6)
 | 
			
		||||
        return self.face
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								yahtzee.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								yahtzee.py
									
									
									
									
									
								
							@@ -109,3 +109,14 @@ class Yahtzee:
 | 
			
		||||
            if die.face in choice_ints:
 | 
			
		||||
                choice_ints.remove(die.face)
 | 
			
		||||
        return len(choice_ints) == 0
 | 
			
		||||
 | 
			
		||||
def play(self):
 | 
			
		||||
        """Play an entire game.
 | 
			
		||||
        Starts by greeting the user, then plays rounds until all the goals 
 | 
			
		||||
        have been used. When the game is over, tells the player their final 
 | 
			
		||||
        score.
 | 
			
		||||
        """
 | 
			
		||||
        print("Welcome to Yahtzee!")
 | 
			
		||||
        while self.count_unused_goals() > 0:
 | 
			
		||||
            self.play_round()
 | 
			
		||||
        print(f"Your final score was {self.score}")
 | 
			
		||||
		Reference in New Issue
	
	Block a user