From 894c48739083775e23d971ca833d99ceb7258d30 Mon Sep 17 00:00:00 2001 From: Luke Meyers Date: Wed, 5 Feb 2020 20:49:29 -0800 Subject: [PATCH] Sprout basic command infrastructure --- game/game.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/game/game.go b/game/game.go index 5f2753b..0018096 100644 --- a/game/game.go +++ b/game/game.go @@ -70,7 +70,11 @@ func UpdateState(sOld State) State { s := sOld for i, t := range s.Teams { - accelerate(t.Baton.Holder) + switch chooseCommand(t, sOld) { + case speedUp: + accelerate(t.Baton.Holder) + } + moveBot(t.Baton.Holder, sOld) maybePassBaton(&s.Teams[i]) } @@ -84,6 +88,16 @@ func UpdateState(sOld State) State { return s } +func chooseCommand(t Team, s State) command { + return speedUp +} + +type command int + +const ( + speedUp command = iota +) + func maybePassBaton(t *Team) { for i, b := range t.Bots { h := t.Baton.Holder