aboutsummaryrefslogtreecommitdiff
path: root/goffel.go
diff options
context:
space:
mode:
Diffstat (limited to 'goffel.go')
-rw-r--r--goffel.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/goffel.go b/goffel.go
new file mode 100644
index 0000000..3bc3311
--- /dev/null
+++ b/goffel.go
@@ -0,0 +1,35 @@
+package main
+
+import (
+ "math/rand"
+ "time"
+)
+
+type UI interface {
+ Init() error
+ Round(r int) error
+ BroadcastWinner()
+}
+
+func play(ui UI) {
+ err := ui.Init()
+ if err != nil {
+ panic(err)
+ }
+
+ for round := 1; round <= 13; round++ {
+ err = ui.Round(round)
+ if err != nil {
+ panic(err)
+ }
+ }
+ ui.BroadcastWinner()
+}
+
+func main() {
+ rand.Seed(time.Now().Unix())
+
+ var ui UI
+
+ play(&Interactive{})
+}