summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.go b/main.go
index beae39f..5d0829e 100644
--- a/main.go
+++ b/main.go
@@ -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 {