8 Oct 2006

How to cut ogonek with a snake?

This weekend I have been coding one nice feature for Tonic for those who sometimes forget how lazy fics happens to be ;). Have you ever forgot to be careful when sending text to fics? If you happen to come from a country which language uses some special (non-ASCII) signs, you sometimes might be surprised how inhospitable fics is (for those who haven't experience it yet - fics disconnects user when she sends some non-ASCII character to server). From now on Tonic is smarter then you... or the server :). It converts letter with ogoneks, acutes, strokes etc. to simple letter, but it also, just to be sure that fics don't disconnects on you, cut other non-ASCII characters to '?'. Anyway, now you can cut'n'paste anything to Tonic to send to server, enjoy!

And as far as concerns goes for next release - it will happen soon. Most notable feature for bridge4 will be ability to observe Bughouse/Crazyhouse games. You will be also able to examine or play such games, but there won't be any gui for it, yet. Less notable feature is that you will be able to play pawns-only wild variant.

I've almost forgotten to explain the title of this post. To make Tonic convert letters with ogoneks I've used simple switch statement. Statement is simple, but the number of latin letter with other characters is quite long... And this is the place where smart ficsers and snake comes into play. Not to mention google... maciejg suggested that I should parse the site with Unicode tabel, which, after, something like 5 hours of struggling with Python, I did. There are 182 case statements in Tonic for converting letters. I am sooo glad I didn't have to do it by hand. Of course, it could take this 5 hours of learning basics of Python, but it wouldn't be fun, would it? And Python is so smooth and silky I really don't regret this time.

No comments:

Post a Comment