r/chessprogramming • u/kjiomy • May 25 '26
Chess engine next steps
Hi, I've been building a chess engine from scratch in c++ as a side project.
I've currently implemented iterative deepening, a negamax algorithm, quiescence search and transposition tables.
It currently manages to get to depth 8 in a few seconds, with around 7-14 million nodes visited.
I was wondering what would be the next steps to make it better, I know two major things are changing the generation of sliding pieces from a for loop to magic bitboards, and making a better evaluation function, maybe implementing an nnue.
These are big changes tho, and I was wondering if there's anything that I should do before.
View all comments
Show parent comment
1
u/NazComHere May 30 '26
def search(position, depth, alpha, beta):# 1. BASE CHECKS# If we are in check, we cannot use Null Move (must escape check)# If in endgame (only kings/pawns), disable NMP to avoid zugzwang trapsif not in_check(position) and not is_endgame(position) and depth >= R + 1:# 2. THE NULL MOVE# Pass the turn to the opponentposition.make_null_move()# 3. REDUCED SEARCH# Search the position with reduced depth (R is usually 2 or 3)# We negate the score because the side to move has changedscore = -search(position, depth - 1 - R, -beta, -beta + 1)# 4. PRUNING# If the position is still "winning" even after passing,# return the score (beta-cutoff)position.unmake_null_move()if score >= beta:return score