public static void AddDiagonalMoves(Position currentPosition, Figure fig) { for (int i = 1; i <= currentPosition.X; i++) { if (currentPosition.Y - i >= 0) { Position p = new Position(currentPosition.X - i, (currentPosition.Y - i)); fig.validMoves.Add(p); } if (currentPosition.Y + i <= 7) { Position p = new Position(currentPosition.X - i, (currentPosition.Y + i)); fig.validMoves.Add(p); } } for (int i = 1; i <= 7 - currentPosition.X; i++) { if (currentPosition.Y - i >= 0) { Position p = new Position(currentPosition.X + i, (currentPosition.Y - i)); fig.validMoves.Add(p); } if (currentPosition.Y + i <= 7) { Position p = new Position(currentPosition.X + i, (currentPosition.Y + i)); fig.validMoves.Add(p); } } }
internal PlayerMoveDTO Move(Figure[,] board) { return new PlayerMoveDTO(); }
public static void AddHorizontalMoves(Position currentPosition, Figure fig) { for (int i = 0; i < currentPosition.X; i++) { Position p = new Position(i, currentPosition.Y); fig.validMoves.Add(p); } for (int i = currentPosition.X + 1; i <= 7; i++) { Position p = new Position(i, currentPosition.Y); fig.validMoves.Add(p); } }
public static void AddVerticalMoves(Position currentPosition, Figure fig) { for (int i = 0; i < currentPosition.Y; i++) { Position p = new Position(currentPosition.X, i); fig.validMoves.Add(p); } for (int i = currentPosition.Y + 1; i <= 7; i++) { Position p = new Position(currentPosition.X, i); fig.validMoves.Add(p); } }