Yes this is really incredibleDon wrote: I cannot believe you posted this

I didn't read your other post and I noticed this Stockfish _bug_ only this afternoon. It is really amazing becuase this case insensitivity rule is out there from years and it happens that only this afternoon I noticed that and only this afternoon you posted your very strict related comment.
I guess if someone would calculate the probability of such an event well that should be really really low

Anyhow, in SF options are stored in a standard map std::map, so I needed to add something like the below:
Code: Select all
// Custom comparator because UCI options should not be case sensitive
struct CaseInsensitiveLess {
bool operator() (const std::string&, const std::string&) const;
};
typedef std::map<std::string, Option, CaseInsensitiveLess> OptionsMap;
Code: Select all
// Our case insensitive Less() function as required by UCI protocol
bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const {
int c1, c2;
size_t i = 0;
while (i < s1.size() && i < s2.size())
{
c1 = tolower(s1[i]);
c2 = tolower(s2[i++]);
if (c1 != c2)
return c1 < c2;
}
return s1.size() < s2.size();
}
This is not general purpose full solution because it handles only ASCII character set. A real complete solution should properly handle locales, but it becomes really complex.....I don't know if it is required....what mandates UCI protocol regarding character set to be used by options ?