So far the bot has been predicting whose turn it is only from the post title. It was simply looking for phrases like "white to play", "for white", etc. Now it becomes much smarter.
u/chessvision-ai-bot is on a roll: now it can predict whose turn it is from the highlighted squares on the board. A very famous position, this title doesn't hint whose turn is it to play. More in comments from r/chess
How it works?
The bot now uses computer vision techniques to determine whose turn is it to play by trying to find two highlighted squares denoting the last move that was made, in this case, two squares highlighted with yellow color.
The task probably looks trivial to us humans, but doing it consistently for a machine with different board styles, highlight colors, other highlights that may appear on the board, arrows, etc. turned out to be a very interesting problem to solve. I enjoyed it much - thanks for all of you that were pushing me to do it. I updated the bot yesterday so far it looks like it's been working perfectly.
This is the last update in the most recent series of updates including also predicting board orientation from the coordinates, automatic stalemate detection, and giving a detailed description of games with the recognized position. I think the bot is now a quite complete package and I'll move my efforts towards other projects that share some techniques with the bot.