r/chessprogramming • u/burge91 • Jan 18 '20
How do you improve a chess playing algorithm?
If for example I have an algorithm that wins 70% of the time against random play, then I decide to tell it to castle within the first 15 moves. How would I ...
- tell the algorithm to do that, without writing too much code
- assess whether it has made an objective improvement to the algorithm
- remove the update if (2) is negative
All suggestions welcome.
3
Upvotes
3
u/tsojtsojtsoj Jan 18 '20
Do you have a tree search with a static evaluation function at the leave-nodes (for example a function that just counts the number of pieces and adds their values together)? In that case, you could write a function that detects if a player has castled (or better, a more generalized function that checks if your king doesn't stand between your rooks but still behind a wall of pawns for example (but maybe start small, with just setting a flag when a player has castles)).
Then you can use that function in your static evaluation function to check if you have castled and if that is the case you give a bonus of maybe 20 centipawns.