@@ -176,100 +176,6 @@ GenMoves::~GenMoves() {
176176 free (repetitionMap);
177177}
178178
179- // bool GenMoves::isPinned(const int side, const uchar position, const uchar piece) {
180- // u64 king = chessboard[KING_BLACK + side];
181- // int posKing = BITScanForward(king);
182- // u64 pow2position = POW2[position];
183- // if(!(LEFT_RIGHT_RANK_FILE[posKing] & pow2position)) {
184- // return false;
185- // }
186- // int xside = side ^ 1;
187- // chessboard[piece] &= NOTPOW2[position];
188- // u64 allpieces = getBitmap<WHITE>() | getBitmap<BLACK>();
189- // u64 qr = chessboard[QUEEN_BLACK + xside] | chessboard[ROOK_BLACK + xside];
190- // u64 qb = chessboard[QUEEN_BLACK + xside] | chessboard[BISHOP_BLACK + xside];
191- // if(king & RANK[position] && RANK[position] & qr) {
192- // //rank
193- // for(int n = position + 1; n <= ORIZ_LEFT[position]; n++) {
194- // if(qr & POW2[n]) {
195- // chessboard[piece] |= pow2position;
196- // return true;
197- // }
198- // if(allpieces & POW2[n]) {
199- // break;
200- // }
201- // }
202- // for(int n = position - 1; n >= ORIZ_RIGHT[position]; n--) {
203- // if(qr & POW2[n]) {
204- // chessboard[piece] |= pow2position;
205- // return true;
206- // }
207- // if(allpieces & POW2[n]) {
208- // break;
209- // }
210- // }
211- // } else if(king & FILE_[position] && FILE_[position] & qr) {
212- // for(int n = posKing + 8; n <= VERT_UPPER[posKing]; n += 8) {
213- // if(qr & POW2[n]) {
214- // chessboard[piece] |= pow2position;
215- // return true;
216- // }
217- // if(POW2[n]&allpieces) {
218- // break;
219- // }
220- // }
221- // for(int n = posKing - 8; n >= VERT_LOWER[posKing]; n -= 8) {
222- // if(qr & POW2[n]) {
223- // chessboard[piece] |= pow2position;
224- // return true;
225- // }
226- // if(POW2[n]&allpieces) {
227- // break;
228- // }
229- // }
230- // } else if(king & LEFT_DIAG[position] && LEFT_DIAG[position] & qb) {
231- // for(int n = position + 7; n <= LEFT_UPPER[position]; n += 7) {
232- // if(qb & POW2[n]) {
233- // chessboard[piece] |= pow2position;
234- // return true;
235- // }
236- // if(allpieces & POW2[n]) {
237- // break;
238- // }
239- // }
240- // for(int n = position - 7; n >= LEFT_LOWER[position]; n -= 7) {
241- // if(qb & POW2[n]) {
242- // chessboard[piece] |= pow2position;
243- // return true;
244- // }
245- // if(allpieces & POW2[n]) {
246- // break;
247- // }
248- // }
249- // } else if(king & RIGHT_DIAG[position] && RIGHT_DIAG[position] & qb) {
250- // for(int n = position + 9; n <= RIGHT_UPPER[position]; n += 9) {
251- // if(qb & POW2[n]) {
252- // chessboard[piece] |= pow2position;
253- // return true;
254- // }
255- // if(allpieces & POW2[n]) {
256- // break;
257- // }
258- // }
259- // for(int n = position - 9; n >= RIGHT_LOWER[position]; n -= 9) {
260- // if(qb & POW2[n]) {
261- // chessboard[piece] |= pow2position;
262- // return true;
263- // }
264- // if(allpieces & POW2[n]) {
265- // break;
266- // }
267- // }
268- // }
269- // chessboard[piece] |= pow2position;
270- // return false;
271- // }
272-
273179void GenMoves::performCastle (const int side, const uchar type) {
274180 ASSERT_RANGE (side, 0 , 1 );
275181 if (side == WHITE) {
@@ -399,70 +305,6 @@ bool GenMoves::performKingShiftCapture(int side, const u64 enemies) {
399305 return false ;
400306}
401307
402-
403- // template<int side>
404- // bool GenMoves::attackSquare(const uchar position, u64 allpieces) {
405- // ASSERT_RANGE(position, 0, 63);
406- // ASSERT_RANGE(side, 0, 1);
407- // if (KNIGHT_MASK[position] & chessboard[KNIGHT_BLACK + (side ^ 1)]) {
408- // return true;
409- // }
410- // if (NEAR_MASK1[position] & chessboard[KING_BLACK + (side ^ 1)]) {
411- // return true;
412- // }
413- // //enpassant
414- // if (PAWN_FORK_MASK[side][position] & chessboard[PAWN_BLACK + (side ^ 1)]) {
415- // return true;
416- // }
417- // allpieces |= POW2[position];
418- // u64 enemies = chessboard[QUEEN_BLACK + (side ^ 1)] | chessboard[BISHOP_BLACK + (side ^ 1)];
419- // if (LEFT_RIGHT_DIAG[position] & enemies) {
420- // ///LEFT
421- // u64 q = allpieces & MASK_BIT_UNSET_LEFT_UP[position];
422- // if (q && enemies & POW2[BITScanReverse(q)]) {
423- // return true;
424- // }
425- // q = allpieces & MASK_BIT_UNSET_LEFT_DOWN[position];
426- // if (q && enemies & POW2[BITScanForward(q)]) {
427- // return true;
428- // }
429- // ///RIGHT
430- // q = allpieces & MASK_BIT_UNSET_RIGHT_UP[position];
431- // if (q && enemies & POW2[BITScanReverse(q)]) {
432- // return true;
433- // }
434- // q = allpieces & MASK_BIT_UNSET_RIGHT_DOWN[position];
435- // if (q && enemies & POW2[BITScanForward(q)]) {
436- // return true;
437- // }
438- // }
439- // ///
440- // u64 x = allpieces & FILE_[position];
441- // enemies = chessboard[QUEEN_BLACK + (side ^ 1)] | chessboard[ROOK_BLACK + (side ^ 1)];
442- // if (x & enemies) {
443- // u64 q = x & MASK_BIT_UNSET_UP[position];
444- // if (q && enemies & POW2[BITScanReverse(q)]) {
445- // return true;
446- // }
447- // q = x & MASK_BIT_UNSET_DOWN[position];
448- // if (q && enemies & POW2[BITScanForward(q)]) {
449- // return true;
450- // }
451- // }
452- // x = allpieces & RANK[position];
453- // if (x & enemies) {
454- // u64 q = x & MASK_BIT_UNSET_RIGHT[position];
455- // if (q && enemies & POW2[BITScanForward(q)]) {
456- // return true;
457- // }
458- // q = x & MASK_BIT_UNSET_LEFT[position];
459- // if (q && enemies & POW2[BITScanReverse(q)]) {
460- // return true;
461- // }
462- // }
463- // return false;
464- // }
465-
466308void GenMoves::unPerformCastle (const int side, const uchar type) {
467309 ASSERT_RANGE (side, 0 , 1 );
468310 if (side == WHITE) {
@@ -801,34 +643,6 @@ bool GenMoves::generatePuzzle(const string type) {
801643 }
802644 }
803645
804- /* if (type == "KRKP") {
805- pieces.push_back(ROOK_BLACK);
806- pieces.push_back(PAWN_WHITE);
807- } else if (type == "KQKP") {
808- pieces.push_back(QUEEN_BLACK);
809- pieces.push_back(PAWN_WHITE);
810-
811- } else if (type == "KBBKN") {
812- pieces.push_back(BISHOP_BLACK);
813- pieces.push_back(BISHOP_BLACK);
814- pieces.push_back(KNIGHT_WHITE);
815-
816- } else if (type == "KQKR") {
817- pieces.push_back(QUEEN_BLACK);
818- pieces.push_back(ROOK_WHITE);
819-
820- } else if (type == "KRKB") {
821- pieces.push_back(ROOK_BLACK);
822- pieces.push_back(BISHOP_WHITE);
823-
824- } else if (type == "KRKN") {
825- pieces.push_back(ROOK_BLACK);
826- pieces.push_back(KNIGHT_WHITE);
827-
828- } else {
829- cout << "error type";
830- return;
831- }*/
832646 writeRandomFen (pieces);
833647 }
834648 return true ;
0 commit comments