diff options
| -rw-r--r-- | main.go | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -4,6 +4,7 @@ import ( "flag" "fmt" "log" + "math" "math/rand" "sync" "time" @@ -73,9 +74,16 @@ func game(numPlayers, faces int) { close(scores) }() + minScore := Score{score: math.MaxInt} + for score := range scores { - fmt.Printf("%v\n", score) + if score.score < minScore.score { + minScore = score + } } + + fmt.Printf("Player %d won with a score of %d\n", minScore.id, minScore.score) + fmt.Println("Thanks for playing!") } func throwDie(faces int) int { |
