Silly mistakes

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

eligolf
Posts: 114
Joined: Sat Nov 14, 2020 12:49 pm
Full name: Elias Nilsson

Silly mistakes

Post by eligolf »

I was playing my bot a few games and found that it really played strange in endgames and not what I was expecting it to do. For example it kept its king near g1/g8 which made me think that it was something wrong with how I went from opening to endgame in my PST. Sure enough, I had written my eval as follows:

Code: Select all

// Calculate the current phase
int gamePhaseOpening = Math.Max(boardState.CurrentGamePhase, EvaluationConstants.phaseResolution);
int gamePhaseEnding = EvaluationConstants.phaseResolution - gamePhaseOpening;

// Calculate the scores from PST tables (white minus black score)
int scoreOpening = boardState.PSTValues[Color.White][GamePhase.Opening] - boardState.PSTValues[Color.Black][GamePhase.Opening];
int scoreEnding = boardState.PSTValues[Color.White][GamePhase.Ending] - boardState.PSTValues[Color.Black][GamePhase.Ending];

// Tapered evaluation (https://www.chessprogramming.org/Tapered_Eval)
int score = ((scoreOpening * gamePhaseOpening) + (scoreEnding * gamePhaseEnding)) / EvaluationConstants.phaseResolution;
First row I accidentally set Math.Max instead of Math.Min which made the opening phase always be maximum value and it never went into endgame. After a quick change it was now playing decent endgames, or at least as I expected it to from the endgame tables :)

Such small mistake that leads to massive decrease in strength... At least this mistake was fairly simple to find :)

Do you have any examples of small or hard-to-find mistakes which lead to large consequences?