add coast command

This commit is contained in:
Luke Meyers 2020-02-08 20:42:13 -08:00
parent 70600a1142
commit e80f51a700
1 changed files with 6 additions and 2 deletions

View File

@ -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: