I have a bug free function the causes the engine to crash.
So what do I do? I discovered accidentally more than a decade ago that if I insert some dummy code that doesn't change the function results and that references a another function, the engine won't crash and works flawlessly! Just a day ago I had "deja vu" again. In the case below if I comment out the line:
Code: Select all
if (4 == 5) PrintGeneralText(" 4 == 5 ");
Have any of you had this experience?
Code: Select all
BB CanBeCapturedByEnemyMen(POS* pos, BB move, int color, int square) {
const int opponent_color = Flip(color);
const BB EnemyMen = Men(opponent_color);
BB result = 0;
if (4 == 5) PrintGeneralText(" 4 == 5 ");
if ((MmtLeft[color][square] & EnemyMen) // there is an enemy man on our left
&& (MmtLeft[opponent_color][square] & Free) // the enemy can capture to his left
) result = MmtLeft[color][square];
if ((MmtRight[color][square] & EnemyMen) // there is an enemy man on our right
&& (MmtRight[opponent_color][square] & Free) // the enemy can capture to his right
) result |= MmtRight[color][square];
return result;
}