Code: Select all
char getDir(int f, int t) {
if (!((f ^ t) & 56)) return 8;
if (!((f ^ t) & 7)) return 16;
return ((f - t) % 7) ? 32 : 64;
}
Francisco Modesto, the author of the Java engine chess (https://github.com/fmodesto/chessy/tree ... ech/chessy) wrote me an email in the year 2018 (!) about the bug. The correct implementation is:
Code: Select all
char getDir(int f, int t) {
if (!((f ^ t) & 56)) return 8;
if (!((f ^ t) & 7)) return 16;
return (!((f - t) % 9)) ? 32 : 64;
}
I fixed it in 5.3.3, six years after the release of 5.3.2.
Meanwhile, I noted that this bug not only has impact on strength, it crashes the engine in one game of about 200...300 games. Every version before 5.3.3 had this issue. This is why a created a branch "stable" in
https://github.com/olithink/OliThink/tree/stable
where every version before 5.3.3 has the fix. Thus 5.3.2 in "stable" is equal to "5.3.3" in master.
Every version since 5.0.0 has been stabilised and can play now thousands of games without any crash.