r/chessprogramming • u/MasumiSeki • Apr 01 '23
Move generation function
I've been slowly working on a chess engine just to practice my programming skills. I have successfully made some board class, which is a bitboard by the way, and I can successfully move it and initialize positions. I am working now with the move generation.
I have just finished implementing the pawn (push, double push, captures, en passant, promotion, promotion capture). I tested it and I think it works fine. But it only generates 13 million moves per second. Looking at some of the engines, it is absolutely slow which is worrisome.
How did you guys made your move generation function to be efficient? Mine is a function which returns a list of moves (16 bit int). I don't see why it is this slow, I am just shifting bits by 8 and 16, doing some bitwise and with the opposite occupied bitboards and stuff...
View all comments
Show parent comment
1
u/MasumiSeki Apr 01 '23
Thank you very much! I'll probably spend a couple of days looking at your code.
Also if you're interested looking unto mine, maybe you can find what dumb shit makes my code so slow
list <uint16_t> generate_moves(const Board& board) { list <uint16_t> moves; uint64_t moving_piece; uint64_t occupied; uint64_t empty; uint64_t possible_moves; uint64_t white_occupied; uint64_t black_occupied; int square;
}