diff --git a/game/game.go b/game/game.go index f7ca2ff..5f2753b 100644 --- a/game/game.go +++ b/game/game.go @@ -35,6 +35,10 @@ func NewState() State { Lane: 0, Pos: Steps / 3, }, + { + Lane: 1, + Pos: Steps * 2 / 3, + }, }, } } @@ -66,6 +70,7 @@ func UpdateState(sOld State) State { s := sOld for i, t := range s.Teams { + accelerate(t.Baton.Holder) moveBot(t.Baton.Holder, sOld) maybePassBaton(&s.Teams[i]) } diff --git a/game/physics.go b/game/physics.go index 80aaa09..b2480a6 100644 --- a/game/physics.go +++ b/game/physics.go @@ -2,7 +2,7 @@ package game import "math/rand" -func moveBot(b *Bot, s State) { +func accelerate(b *Bot) { if b.a == 0 { b.a = 1 } @@ -21,7 +21,9 @@ func moveBot(b *Bot, s State) { if b.v < -maxV { b.v = -maxV } +} +func moveBot(b *Bot, s State) { for i := 0; i < b.v; i++ { if !collide(b.id, b.Pos+1, b.Lane, s) { b.Pos++