Ejemplo n.º 1
0
        CommandResult IRoverUnit.Rotate(bool clockwise)
        {
            RoverFacing newFacing;

            if (clockwise)
            {
                newFacing = Status.Facing == RoverFacing.West ? RoverFacing.North : (RoverFacing)((int)Status.Facing + 1);
            }
            else
            {
                newFacing = Status.Facing == RoverFacing.North ? RoverFacing.West : (RoverFacing)((int)Status.Facing - 1);
            }

            Status = new RoverStatus(Status.Position, newFacing);

            return(true);
        }
Ejemplo n.º 2
0
 CommandResult IRoverUnit.MoveTo(MapCoordinates destination)
 {
     Status = new RoverStatus(Map.GetPosition(destination), Status.Facing);
     return(true);
 }
Ejemplo n.º 3
0
 internal RoverUnit(RoverStatus initialStatus, Map map)
 {
     Status        = initialStatus;
     Map           = map;
     CommandModule = new RoverCommandModule(this);
 }