From e80f51a700631749a8e7b13867f820f83e9661ef Mon Sep 17 00:00:00 2001 From: Luke Meyers Date: Sat, 8 Feb 2020 20:42:13 -0800 Subject: [PATCH] add coast command --- game/commands.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/game/commands.go b/game/commands.go index ff36416..4688053 100644 --- a/game/commands.go +++ b/game/commands.go @@ -7,14 +7,15 @@ import ( type Command int const ( - speedUp Command = iota + coast Command = iota + speedUp slowDown left right clearObstacle ) -var validCommands = []Command{speedUp, slowDown, left, right, clearObstacle} +var validCommands = []Command{coast, speedUp, slowDown, left, right, clearObstacle} func PollCommands(s State) []Command { cmds := make([]Command, len(s.Teams)) @@ -36,6 +37,7 @@ func doCommand(cmd Command, s State, teamID int) State { r.Kinetics.A = 0 switch cmd { + case coast: case speedUp: r.Kinetics.A = da *r = accelerate(*r) @@ -68,6 +70,8 @@ func doCommand(cmd Command, s State, teamID int) State { func (c Command) String() string { switch c { + case coast: + return "coast" case speedUp: return "speed up" case slowDown: