diff options
| author | demo <demo@antix1> | 2026-05-24 23:25:34 -0400 |
|---|---|---|
| committer | demo <demo@antix1> | 2026-05-24 23:25:34 -0400 |
| commit | 54294466d5624b6b0ce84c20f118070fa597daa8 (patch) | |
| tree | 5849b38d84d9dec08943438be1f117087b3adbbd | |
| parent | b66bc6e6234e00ebd2e553eb9f43910d649e890f (diff) | |
feat: make number of players configurable
| -rw-r--r-- | main.go | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -12,16 +12,15 @@ type Ball struct{ hits int } func main() { numSecs := flag.Int("s", 1, "Number of seconds game should last") + numPlayers := flag.Int("p", 2, "Number of players") flag.Parse() - game(*numSecs) + game(*numSecs, *numPlayers) } -func game(numSecs int) { +func game(numSecs, numPlayers int) { var wg sync.WaitGroup - // FIXME: make this a flag. - const numPlayers = 7 players := make([]chan Ball, numPlayers+1) players[0] = make(chan Ball) |
