Beispiel #1
0
        public async Task <ActionResult <bool> > Land([FromBody] LandRequestDto landDto)
        {
            if (await _planetService.IsValidTile(landDto.Latitude, landDto.Longitude))
            {
                await _roverService.Land(landDto.Latitude, landDto.Longitude);

                return(Ok($"Rover has landed at {_roverService.Position.Item1},{_roverService.Position.Item2} facing {_roverService.Compass.ToString()}"));
            }
            return(Ok("The rover cannot land there"));
        }
Beispiel #2
0
 private async Task <bool> Move(Tuple <int, int> nextTile)
 {
     if (await _planetService.IsValidTile(nextTile.Item1, nextTile.Item2))
     {
         _rover.Position = nextTile;
         return(true);
     }
     else
     {
         return(false);
     }
 }