diff options
| -rw-r--r-- | main.go | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -74,15 +74,15 @@ func game(numPlayers, faces int) { close(finishedPlayers) }() - minFinishedPlayer := Player{score: math.MaxInt} + minPlayer := Player{score: math.MaxInt} - for score := range finishedPlayers { - if score.score < minFinishedPlayer.score { - minFinishedPlayer = score + for player := range finishedPlayers { + if player.score < minPlayer.score { + minPlayer = player } } - fmt.Printf("Player %d won with a score of %d\n", minFinishedPlayer.id, minFinishedPlayer.score) + fmt.Printf("Player %d won with a score of %d\n", minPlayer.id, minPlayer.score) fmt.Println("Thanks for playing!") } |
