NikolayIT / TcecEvaluationBot

Chat bot for https://tcec-chess.com/
MIT License
15 stars 3 forks source link

Improve !cdb parsing #19

Open noobpwnftw opened 3 years ago

noobpwnftw commented 3 years ago

Text format API has '\0' at end of line for legacy purposes, modern applications can make use of json output by adding &json=1 to the request here: https://github.com/NikolayIT/TcecEvaluationBot/blob/08d287bb833e601a170c84f112d933f781803f5c/src/TcecEvaluationBot.ConsoleUI/Services/ChessDbcnScoreProvider.cs#L34

which will result in responses like this: https://www.chessdb.cn/cdb.php?action=queryall&learn=1&showall=1&board=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR%20w%20KQkq%20-%200%201&json=1 Results will have moves in SAN notations which simplifies this: https://github.com/NikolayIT/TcecEvaluationBot/blob/08d287bb833e601a170c84f112d933f781803f5c/src/TcecEvaluationBot.ConsoleUI/Services/ChessDbcnScoreProvider.cs#L94-L96

NikolayIT commented 3 years ago

In case you have the time, can you send a pull request so I can merge the changes :)

noobpwnftw commented 3 years ago

Local conversion has ambiguity bugs like "Nbd2" show as "Nd2" in this position: r1bqkb1r/pp2pppp/2nP4/8/4n3/5N2/PPP2PPP/RNBQKB1R w KQkq - 1 6