From 700e47bc42b77375658b22fb5efae67a7aeeda83 Mon Sep 17 00:00:00 2001 From: demo Date: Sun, 24 May 2026 23:30:19 -0400 Subject: feat: vet the number of players --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index c2f007f..686981b 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,14 @@ func main() { numPlayers := flag.Int("p", 2, "Number of players") flag.Parse() + // Believe it or not, one player still makes for a valid game, + // since that player simply checks in with the main goroutine, + // who simply sends the ball back to it. + if *numPlayers < 1 { + log.Fatalf("Invalid number of players: %d", *numPlayers) + } + + // Launch the game! game(*numSecs, *numPlayers) } -- cgit v1.2.3