From 340c72e61917d1029ca45f6c5ca91f4c4c4b987d Mon Sep 17 00:00:00 2001 From: "Brandon C. Irizarry" Date: Thu, 23 Apr 2026 16:39:45 -0400 Subject: feat: print a prettified report of the winner --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'main.go') 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 { -- cgit v1.2.3