Yesterday I used the interactive Python prompt to establish a connection to the Free Internet Chess Server (FICS). When I put all the necessary code into one script today, it didn't work so well; there's a bit of delay before responses from the server are available. I tried just sleeping for a brief period, but that still didn't work, so I ended up using expect on the telnet object in the login code.
Once past the login, I used read_until to go line-by-line. FICS is designed to be usable in a plain terminal, so it does its own linewrapping. Alas, there's no way to say "give me lines of unbounded length" (240 characters is the maximum width) so I had to write some finicky logic to reassemble linebroken notifications into logical lines.
With that all done, Exotherm can log in and listen for match requests. Currently it accepts all challenges that match its FICS formula (atomic games of 10 minutes or less) but then just sits there. Now I need to actually start writing some chess logic.
No comments:
Post a Comment