diff --git a/src/attack.c b/src/attack.c index 6ef4618..8f258ea 100644 --- a/src/attack.c +++ b/src/attack.c @@ -117,16 +117,8 @@ bitboard_t sq_attackers(const pos_t *pos, const bitboard_t occ, const square_t s to = pos->bb[c][PAWN]; tmp = bb_pawns_attacks(sqbb, sq_up(opp)) & to; attackers |= tmp; - //to = pos->bb[c][PAWN]; - //tmp = pawn_shift_upleft(sqbb, opp) & to; - //attackers |= tmp; # ifdef DEBUG_ATTACK_ATTACKERS - bb_print("att pawn upleft", tmp); -# endif - //tmp = pawn_shift_upright(sqbb, opp) & to; - //attackers |= tmp; -# ifdef DEBUG_ATTACK_ATTACKERS - bb_print("att pawn upright", tmp); + bb_print("att pawn", tmp); # endif /* knight & king */ @@ -158,7 +150,6 @@ bitboard_t sq_attackers(const pos_t *pos, const bitboard_t occ, const square_t s # ifdef DEBUG_ATTACK_ATTACKERS bb_print("att rook/queen", tmp); bb_print("ATTACKERS", attackers); - printf("attackers=%lx\n", attackers); # endif return attackers; diff --git a/src/move-gen.c b/src/move-gen.c index ffeab3e..e6bef55 100644 --- a/src/move-gen.c +++ b/src/move-gen.c @@ -95,10 +95,10 @@ bool pseudo_is_legal(const pos_t *pos, const move_t move) * One case not handled anywhere else: when the two "disappearing" pawns * would discover a R/Q horizontal check. */ - if (is_enpassant(move)) { - bitboard_t rank5 = bb_rel_rank(RANK_1, us); + if (unlikely(is_enpassant(move))) { + bitboard_t rank5 = bb_rel_rank(RANK_5, us); - if ((pos->bb[us][KING] & rank5)) { + if (unlikely((pos->bb[us][KING] & rank5))) { bitboard_t exclude = BIT(pos->en_passant - sq_up(us)) | BIT(from); bitboard_t rooks = (pos->bb[them][ROOK] | pos->bb[them][QUEEN]) & rank5; diff --git a/test/perft-test.c b/test/perft-test.c index 9a41d1f..ba771d4 100644 --- a/test/perft-test.c +++ b/test/perft-test.c @@ -226,13 +226,14 @@ static __unused void compare_moves(movelist_t *fish, movelist_t *me) static int usage(char *prg) { - fprintf(stderr, "Usage: %s [-d depth] [-p pertf-modules] -n\n", prg); + fprintf(stderr, "Usage: %s [-d depth] [-p pertf-modules] [-n][-v]\n", prg); + fprintf(stderr, "\t-d: depth, -p: 1-3, -n: no SF res check, -v: output moves\n"); return 1; } -int main(int __unused ac, __unused char**av) +int main(int ac, char**av) { - int i = 0, test_line; + int test_line; u64 sf_count = 0, my_count; char *fen; pos_t *pos = NULL, *fenpos; @@ -258,7 +259,7 @@ int main(int __unused ac, __unused char**av) case 'd': depth = atoi(optarg); break; - case 'p': /* 1 or 2 */ + case 'p': /* 1 or 2 or 3 for both */ run = atoi(optarg); break; case 'n': @@ -369,10 +370,6 @@ int main(int __unused ac, __unused char**av) } } printf("\n"); - // pos_del(savepos); - i++; - /* to run first test only */ - // exit(0); } pos_del(pos); if (sf_run) {