Good luck with your engine! And thanks for using KGSB. And please make it fast. KGSB needs the publicity.
And if you start your own Dev Log I will contribute if I can.
Well I don't think that I will start making Dev Log. I don't think that I will start turning my move generator into engine now. This is my first time programming something about chess. I have zero knowledge about search or evaluation algorithms. But I've been reading about move generation for a while now, so I wanted to try program something of my own.
I have put my code on Github if you would like to look at it. Here is a link for current state:
https://github.com/martinnovaak/motor/releases/tag/v0 . I haven't tested it much yet, but it passed all perft tests from CPW. I haven't still done checks if FEN position is legal, so it is possible that it will crash. Also code is still pretty messy (everything in header files, almost no comments in code).
I found interesting way how KGSB can be used in finding pinners. I have added these 4 simple functions:
Code: Select all
static uint64_t bishop_diagonal(int sq, uint64_t occ) {
return dSubset[sq][(((occ & dMask[sq]) * file_b2_b7) >> 58)];
}
static uint64_t bishop_antidiagonal(int sq, uint64_t occ) {
return aSubset[sq][(((occ & aMask[sq]) * file_b2_b7) >> 58)];
}
static uint64_t rook_horizontal(int sq, uint64_t occ) {
return hSubset[sq][(occ >> horizontal_shift_table[sq]) & 63];
}
static uint64_t rook_vertical(int sq, uint64_t occ) {
return vSubset[sq][((((occ >> (sq & 7)) & file_a2_a7) * diag_c2h7) >> 58)];
}
They are really usefull when I need only 1 ray. For example my code to get horizontal pinners:
Code: Select all
uint64_t horizontal_pinners = KGSSB::rook_horizontal(king_square, occupied) & seen_enemy_hv_pieces;
Like that I can get pinners on all rays from king_square:
Code: Select all
uint64_t possibly_pinned_pieces = seen_squares & our_side_occupancy;
uint64_t seen_enemy_pieces = ~(seen_squares & side_occupancy[their_color]);
uint64_t seen_enemy_hv_pieces = seen_enemy_pieces & hv_occupancy[their_color];
uint64_t seen_enemy_ad_pieces = seen_enemy_pieces & ad_occupancy[their_color];
uint64_t horizontal_pinners = KGSSB::rook_horizontal(king_square, occupied) & seen_enemy_hv_pieces;
uint64_t vertical_pinners = KGSSB::rook_vertical(king_square, occupied) & seen_enemy_hv_pieces;
uint64_t antidiagonal_pinners = KGSSB::bishop_antidiagonal(king_square, occupied) & seen_enemy_ad_pieces;
uint64_t diagonal_pinners = KGSSB::bishop_diagonal(king_square, occupied) & seen_enemy_ad_pieces;
It's used in method get_pinners in board.h.
I have also tried to do some profiling. I have never done that before but I think that KGSSB::rook runs aproximately 3-4x times faster than function KGSSB::bishop. So I was thinking that it could be interesting to combine KGSSB::rook with for example Black magic Bishop and queen could be KGSSB::rook | BlackMagic::bishop. It might be interesting to see if it would be faster or not.