]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Perft should return an int64_t not an int
[stockfish] / src / position.cpp
index d3ca869b8215e20e22e947f95e946f4fdfb53116..cf2c7bac5c7d7852624186bf45b4a2f6c95e106b 100644 (file)
@@ -152,9 +152,9 @@ Position::Position(const Position& pos, int th) {
   nodes = 0;
 }
 
-Position::Position(const string& fen, int th) {
+Position::Position(const string& fen, bool isChess960, int th) {
 
-  from_fen(fen);
+  from_fen(fen, isChess960);
   threadID = th;
 }
 
@@ -175,7 +175,7 @@ void Position::detach() {
 /// string. This function is not very robust - make sure that input FENs are
 /// correct (this is assumed to be the responsibility of the GUI).
 
-void Position::from_fen(const string& fen) {
+void Position::from_fen(const string& fen, bool c960) {
 /*
    A FEN string defines a particular position using only the ASCII character set.
 
@@ -274,6 +274,7 @@ void Position::from_fen(const string& fen) {
   castleRightsMask[make_square(initialQRFile, RANK_1)] ^= WHITE_OOO;
   castleRightsMask[make_square(initialQRFile, RANK_8)] ^= BLACK_OOO;
 
+  isChess960 = c960;
   find_checkers();
 
   st->key = compute_key();
@@ -349,7 +350,7 @@ bool Position::set_castling_rights(char token) {
 /// Position::to_fen() returns a FEN representation of the position. In case
 /// of Chess960 the Shredder-FEN notation is used. Mainly a debugging function.
 
-const string Position::to_fen(bool isChess960) const {
+const string Position::to_fen() const {
 
   string fen;
   Square sq;
@@ -436,8 +437,7 @@ void Position::print(Move move) const {
           cout << c << pieceLetters.from_piece(piece) << c << '|';
       }
   }
-  bool chess960 = (cout.iword(0) != 0); // See set960()
-  cout << dottedLine << "Fen is: " << to_fen(chess960) << "\nKey is: " << st->key << endl;
+  cout << dottedLine << "Fen is: " << to_fen() << "\nKey is: " << st->key << endl;
   requestPending = false;
 }
 
@@ -524,7 +524,7 @@ Bitboard Position::attacks_from(Piece p, Square s) const {
   case WB: case BB: return attacks_from<BISHOP>(s);
   case WR: case BR: return attacks_from<ROOK>(s);
   case WQ: case BQ: return attacks_from<QUEEN>(s);
-  default: return StepAttackBB[p][s];
+  default: return NonSlidingAttacksBB[p][s];
   }
 }
 
@@ -537,7 +537,7 @@ Bitboard Position::attacks_from(Piece p, Square s, Bitboard occ) {
   case WB: case BB: return bishop_attacks_bb(s, occ);
   case WR: case BR: return rook_attacks_bb(s, occ);
   case WQ: case BQ: return bishop_attacks_bb(s, occ) | rook_attacks_bb(s, occ);
-  default: return StepAttackBB[p][s];
+  default: return NonSlidingAttacksBB[p][s];
   }
 }