func (b *Board) nextLoc(id RobotID, t botapi.Turn) Loc { currentLoc := b.robotLoc(id) // If they aren't moving, return their current loc if t.Which() != botapi.Turn_Which_move { return currentLoc } // They're moving, return where they're going xOff, yOff := directionOffsets(t.Move()) nextLoc := Loc{ X: currentLoc.X + xOff, Y: currentLoc.Y + yOff, } if b.isValidLoc(nextLoc) { return nextLoc } // TODO: Penalize people for creating incompetent bots that like travelling // to invalid locations, which is the case if we've reached here. return currentLoc }