public RobotCleaner(int x, int y, FacingTo faceTo, int battery, IMap map, IReturnAlgorithm returnAlgorithm, Dictionary <FacingTo, IMovingStrategy> movingStrategies, ICleaningAlgorithm cleaningAlgorithm) { X = x; Y = y; FaceTo = faceTo; Battery = battery; Map = map; ReturnAlgorithm = returnAlgorithm; CleaningAlgorithm = cleaningAlgorithm; _movingStrategies = movingStrategies; }
public void TurnRight() { ValidateMove(1); FaceTo = FaceTo == FacingTo.West ? FacingTo.North : FaceTo - 1; Battery -= 1; }
public void TurnLeft() { ValidateMove(1); FaceTo = FaceTo == FacingTo.North ? FacingTo.West : FaceTo + 1; Battery -= 1; }
/// <summary> /// It will return a propper name in order to show it more friendly /// </summary> /// <param name="facingTo"></param> /// <returns></returns> public static string GetFacingName(FacingTo facingTo) { return(FacingPositions.FirstOrDefault(x => x.Value == facingTo).Key); }
public FinalState(int x, int y, FacingTo facingTo) { this.X = x; this.Y = y; this.FacingTo = Orientations.GetFacingName(facingTo); }