mirror of
				https://github.com/jesperh1/MontyHallStats.git
				synced 2025-11-03 23:08:24 +00:00 
			
		
		
		
	Clarify if the doors are switched
This commit is contained in:
		
							parent
							
								
									a4095d77d2
								
							
						
					
					
						commit
						70a38f2123
					
				
							
								
								
									
										7
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.go
									
									
									
									
									
								
							@ -73,8 +73,13 @@ func main() {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switchedString := "are"
 | 
				
			||||||
 | 
						if !switchDoor {
 | 
				
			||||||
 | 
							switchedString = "isn't"
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Calculate the winning chance
 | 
						// Calculate the winning chance
 | 
				
			||||||
	winningChance := float64(totalWon) / float64(gamesToPlay) * 100.0
 | 
						winningChance := float64(totalWon) / float64(gamesToPlay) * 100.0
 | 
				
			||||||
	fmt.Printf("In %d games\nGames won: %d\nGames Lost: %d\n", gamesToPlay, totalWon, totalLost)
 | 
						fmt.Printf("In %d games\nGames won: %d\nGames Lost: %d\n", gamesToPlay, totalWon, totalLost)
 | 
				
			||||||
	fmt.Printf("This gives you a winning chance of %.2f%% percent\n", winningChance)
 | 
						fmt.Printf("This gives you a winning chance of %.2f%% percent if the doors %s switched\n", winningChance, switchedString)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user