예제 #1
0
파일: Knight.cs 프로젝트: dorotak/TDDKatas
 public void Move(Vector move)
 {
     CurrentPosition = CurrentPosition + move;
 }
예제 #2
0
파일: Knight.cs 프로젝트: dorotak/TDDKatas
 internal void MoveBack(Vector move)
 {
     CurrentPosition = CurrentPosition - move;
 }
예제 #3
0
파일: Knight.cs 프로젝트: dorotak/TDDKatas
 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];
 }
예제 #4
0
파일: Knight.cs 프로젝트: dorotak/TDDKatas
 public bool IsPossible(Vector position)
 {
     return position.X >= 0 && position.X < Board.DimensionX && position.Y >= 0 && position.Y < Board.DimensionY;
 }
예제 #5
0
파일: Knight.cs 프로젝트: dorotak/TDDKatas
 //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());
 }
예제 #6
0
파일: Knight.cs 프로젝트: dorotak/TDDKatas
 public IEnumerable<Vector> GetPossibleAndNotVisited(Vector currentPosition)
 {
     return all
         .Where(x => IsPossibleAndNotVisited(x + currentPosition));
 }
예제 #7
0
파일: Knight.cs 프로젝트: dorotak/TDDKatas
 public Knight(Vector initialCoordintates, Board board)
 {
     InitialPosition = initialCoordintates;
     CurrentPosition = initialCoordintates;
     Board = board;
 }