Sprout basic command infrastructure
This commit is contained in:
parent
c8c9451e51
commit
894c487390
16
game/game.go
16
game/game.go
|
@ -70,7 +70,11 @@ func UpdateState(sOld State) State {
|
||||||
s := sOld
|
s := sOld
|
||||||
|
|
||||||
for i, t := range s.Teams {
|
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)
|
moveBot(t.Baton.Holder, sOld)
|
||||||
maybePassBaton(&s.Teams[i])
|
maybePassBaton(&s.Teams[i])
|
||||||
}
|
}
|
||||||
|
@ -84,6 +88,16 @@ func UpdateState(sOld State) State {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func chooseCommand(t Team, s State) command {
|
||||||
|
return speedUp
|
||||||
|
}
|
||||||
|
|
||||||
|
type command int
|
||||||
|
|
||||||
|
const (
|
||||||
|
speedUp command = iota
|
||||||
|
)
|
||||||
|
|
||||||
func maybePassBaton(t *Team) {
|
func maybePassBaton(t *Team) {
|
||||||
for i, b := range t.Bots {
|
for i, b := range t.Bots {
|
||||||
h := t.Baton.Holder
|
h := t.Baton.Holder
|
||||||
|
|
Loading…
Reference in New Issue