summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.go b/main.go
index 7e2180a..c812764 100644
--- a/main.go
+++ b/main.go
@@ -12,6 +12,10 @@ func main() {
numSecs := flag.Int("s", 1, "Number of seconds game should last")
flag.Parse()
+ game(*numSecs)
+}
+
+func game(numSecs int) {
table := make(chan Ball)
go player("ping", table)
go player("pong", table)
@@ -19,7 +23,7 @@ func main() {
table <- Ball{}
// Make the game last this long.
- time.Sleep(time.Duration(*numSecs) * time.Second)
+ time.Sleep(time.Duration(numSecs) * time.Second)
// Game over: grab the ball.
<-table