Add command "charge" to charge up the rover's energy store
This commit is contained in:
parent
15c337c067
commit
e875f82b13
4 changed files with 45 additions and 0 deletions
|
@ -371,6 +371,7 @@ func (w *World) Enqueue(rover string, commands ...Command) error {
|
|||
}
|
||||
case CommandStash:
|
||||
case CommandRepair:
|
||||
case CommandCharge:
|
||||
// Nothing to verify
|
||||
default:
|
||||
return fmt.Errorf("unknown command: %s", c.Command)
|
||||
|
@ -458,6 +459,11 @@ func (w *World) ExecuteCommand(c *Command, rover string) (err error) {
|
|||
r.Integrity = r.Integrity + 1
|
||||
w.Rovers[rover] = r
|
||||
}
|
||||
case CommandCharge:
|
||||
_, err := w.ChargeRover(rover)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("unknown command: %s", c.Command)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue