Goofing around with Unicode…

April 26, 2009 | Checkers | By: Mark VandeWettering

I’m kind of old school. I tend to write a lot of programs with character, line oriented interfaces. Part of it is sort of an organized laziness: I’d rather spend my time working on “the real” part of the program. But sometimes, you realize that your program could be enhanced by a little nicer look. Recently, I’ve become interested in the potential of using Unicode to augment the kind of symbols that we can use in program output. I recently discovered that there are Unicode glyphs for checkers in the map. While they aren’t as nice as the postscript generated graphics that I’ve done before, they are nicer than just using R and W like in my conventional program. To test out what could be done, I made a little Python program that output the starting board. Witness:


This is rendered with the GNU unifont, which don’t exactly have glamorous glyphs, but they are quite legible. I might actually add this to my checkers program.

Addendum: I wrote the above in Python, which has a lot of nifty support for Unicode strings. I thought it would be relatively simple to figure out how to do this in C, but as it turns out, it’s not as easy as I thought. Also, the checkers characters are double width, and editors like vim don’t seem to really like double wide characters that much. Harumph. I’ll figure out how to do this some other time.