summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordemo <demo@antix1>2026-05-24 23:30:19 -0400
committerdemo <demo@antix1>2026-05-24 23:30:19 -0400
commit700e47bc42b77375658b22fb5efae67a7aeeda83 (patch)
treededef02603ea1e32d480bdce5a4faf69d738f004
parent5d714273d9caa303ae2d6f01c541afe562d4d240 (diff)
feat: vet the number of players
-rw-r--r--main.go8
1 files changed, 8 insertions, 0 deletions
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)
}