public void Move(Vector move) { CurrentPosition = CurrentPosition + move; }
internal void MoveBack(Vector move) { CurrentPosition = CurrentPosition - move; }
public bool IsPossibleAndNotVisited(Vector position) { return position.X >= 0 && position.X < Board.DimensionX && position.Y >= 0 && position.Y < Board.DimensionY && !Board.Map[position.X, position.Y]; }
public bool IsPossible(Vector position) { return position.X >= 0 && position.X < Board.DimensionX && position.Y >= 0 && position.Y < Board.DimensionY; }
//The optimalisation is needed for bigger boards. The possible moves are sorted //by the number of possible moves in the next step public IEnumerable<Vector> GetPossibleAndNotVisitedAndOrdered(Vector currentPosition) { return all .Where(x => IsPossibleAndNotVisited(x + currentPosition)) .OrderBy(x => GetPossibleAndNotVisited(x + currentPosition).Count()); }
public IEnumerable<Vector> GetPossibleAndNotVisited(Vector currentPosition) { return all .Where(x => IsPossibleAndNotVisited(x + currentPosition)); }
public Knight(Vector initialCoordintates, Board board) { InitialPosition = initialCoordintates; CurrentPosition = initialCoordintates; Board = board; }