ChessPy
A while ago I wrote a chess module for Python. Now this is not a chess-playing module, rather it parses chess moves, stores board positions and works out legal moves. It can also read and write PGN files. I can fairly confidently declare myself as an expert in this kind of thing, having written the PC chess game Chess Commander.
Chess is something that is very well defined, the rules are laid out in black and white, but there are enough juicy problems and gotchas to make it interesting to work on. It was the special case moves such as en passant and castling that were most tricky. I made extensive use of Python’s generators extensively which did simplify things a great deal.
There was already a python chess module in existence, by Eric Max Francis, but this version supports stalemate / draw rules and FEN output. It was originally written just for the hell of it, but I have since decided to dust it off and use it to create an AJAX chess website - which is why I present it here for feedback.
I’d be interested in help with optimization. It was designed to be flexible (ie possibly support chess variations) and speed was a secondary considerations. But if my AJAX chess site is successful it could be doing a lot of processing, so any tips would be appreciated! Although they may be moot since Psyco gives a significant speed boost.
June 19th, 2006 at 11:09 am
While I can’t offer any development help I am currently looking for exactly what you’ve proposed: an AJAX chess application. Everything that is similar on sourceforge is dead or just junk.
PS. The ChessPy you’ve developed; what licensing terms are you releasing it under?
June 19th, 2006 at 7:15 pm
I’m afraid I’ve only just begun the AJAX chess project, and I’ll be working on it in my spare time. So it may be a while before a release.
For non-commercial use it is free in return for a credit. I’m not sure about commerical use yet, but I may end up just releasing it on some liberal open source license. I’ll need to give it some thought!
August 24th, 2006 at 12:00 pm
Hi Will,
Thanks for writing the module. I am willing to help development of the module. I wrote a full PGN parser and database program in the past, so I can extend the module so that it can handle variations as well. Just let me know if you are interested.
How’s work on the AJAX chess website? There is a site, http://www.lutanho.net, that contains a javascript chess library. Maybe you could use that as well. I am planning on including it on the website of my chessclub, so that people can setup chess diagrams through the web.
Regards,
Hans
August 24th, 2006 at 9:17 pm
Hi Hans,
Please do extend it as you see fit. I don’t have time to do much work on it, but any improvements will be gratefully received! I deliberately made provision for exotics flavors of chess - the board width and height are parameters and not hard coded as 8 - so hopefuly it wont be too painful to adapt. Not sure how well I stuck to that through the entire module though.
I’m afraid I’ve abandoned the AJAX chess idea. Just for lack of time, but I may pick it up again at some point in the future…
Email me if you need more information - my email address is in the About page.
Regards,
Will
August 25th, 2006 at 12:11 pm
Hi Will,
Okay thanks.
I have already started adding support for variations and moving though them. Is it okay to release the whole of the module under an Open Source license?
Hans