Beispiel #1
0
 public void IsColorInCheck(string p_test, string p_fen, bool p_result)
 {
     Position position = new Position(p_fen);
       Debug.Print(p_test + " from FEN " + p_fen + "\n");
       Debug.Print(position.ToString());
       Assert.Equal(position.IsColorInCheck(BitBoard.COLOR_BLACK), p_result);
 }
Beispiel #2
0
 public void GetLegalMoves(string p_test, string p_fen, int p_expectedCountOfMove)
 {
     Position positionFromFen = new Position(p_fen);
       Debug.Print(p_test + " from FEN " + p_fen + "\n");
       Debug.Print(positionFromFen.ToString());
       MoveList moveList = positionFromFen.GetLegalMoves();
       Debug.Print("MoveList:\n");
       Debug.Print(moveList.ToString());
       Assert.Equal(p_expectedCountOfMove, moveList.CountMoves);
 }
Beispiel #3
0
 public void PositionFromFen(string p_test, string p_fen)
 {
     Position positionFromFen = new Position(p_fen);
       Debug.Print(p_test + " from FEN " + p_fen + "\n");
       Debug.Print(positionFromFen.ToString());
 }
Beispiel #4
0
 public Position MakeMove(int p_fromIndex, int p_toIndex, int p_pieceType, int p_promotionToPieceType)
 {
     //TODO Implement MakeMove
       Position newPosition = new Position(this);
       newPosition.Pieces[ColorToMove | p_pieceType] &= BitBoard.NegationOfSquare[p_fromIndex];
       if (p_promotionToPieceType == 0)
       {
     newPosition.Pieces[ColorToMove | p_pieceType] |= BitBoard.Square[p_toIndex];
       }
       else
       {
     newPosition.Pieces[ColorToMove | p_promotionToPieceType] |= BitBoard.Square[p_toIndex];
       }
       newPosition.ColorToMove = 1 - newPosition.ColorToMove;
       newPosition.HalfMoves++;
       return newPosition;
 }
Beispiel #5
0
 private Position(Position p_position)
 {
     ColorToMove = p_position.ColorToMove;
       for (int i = 0; i < 16; i++)
       {
     Pieces[i] = p_position.Pieces[i];
       }
       EnPassant = p_position.EnPassant;
       for (int i = 0; i < 2; i++)
       {
     CastleKingside[i] = p_position.CastleKingside[i];
     CastleQueenside[i] = p_position.CastleQueenside[i];
       }
       FiftyMovesClock = p_position.FiftyMovesClock;
       HalfMoves = p_position.HalfMoves;
 }