mirror of
https://github.com/jesperh1/MontyHallStats.git
synced 2025-06-08 04:18:46 +01:00
Change the wording
This commit is contained in:
parent
f7d496c56a
commit
0db445c829
10
main.go
10
main.go
@ -46,7 +46,7 @@ func play_game(switchDoor bool) bool {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// How many games to play
|
// How many games to play
|
||||||
gamesToPlay := 10000
|
gamesToPlay := 100000
|
||||||
games := make([]int, gamesToPlay)
|
games := make([]int, gamesToPlay)
|
||||||
|
|
||||||
// Should the door be switched?
|
// Should the door be switched?
|
||||||
@ -73,13 +73,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switchedString := "are"
|
switchedString := "switched the door"
|
||||||
if !switchDoor {
|
if !switchDoor {
|
||||||
switchedString = "isn't"
|
switchedString = "kept the original door"
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 if the doors %s switched\n", winningChance, switchedString)
|
fmt.Printf("This gave you an average of %.2f%% percent chance of winning if you %s\n", winningChance, switchedString)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user