New Python chess module

W

Will McGugan

Hi folks,

I've written a Python chess module that does the following.

* Reads / Writes PGN files
* Write FEN files
* Validates moves
* Lists legal moves
* Detects check / mate / stalemate / 50 move rule / threefold repetition

Its still rough around the edges and not fully tested. I'll eventualy
release a more polished version and possibly put it on Sourceforge. In
the meantime I would be grateful for any feedback..

http://www.willmcgugan.com/chess.zip

I am aware of the chess module by Erik Max Francis. It may have been
more sensible to work on his version, but I did this mainly for the fun
of it. I wrote a chess game in C++ a while back
(http://www.chesscommander.com) and I thought it would be interesting to
re-implement the chess library part in Python.


Regards,

Will McGugan
 
P

Pekka Karjalainen

Its still rough around the edges and not fully tested. I'll eventualy
release a more polished version and possibly put it on Sourceforge. In
the meantime I would be grateful for any feedback..

Somebody ought to comment this in more detail...

I have one minor point. It looks like your test whether the location is on
the board is needlessly complex. Python understands multiple comparisons
like in mathematical notation, and not like in e.g. C language. This
snippet shows what I mean:
[x for x in range(10) if 2<x<7] # 2<x<7 means 2<x and x<7
[3, 4, 5, 6]

Read about it in the reference:
http://www.python.org/doc/2.4.2/ref/comparisons.html
 
W

Will McGugan

Pekka said:
I have one minor point. It looks like your test whether the location is on
the board is needlessly complex. Python understands multiple comparisons
like in mathematical notation, and not like in e.g. C language. This
snippet shows what I mean:

[x for x in range(10) if 2<x<7] # 2<x<7 means 2<x and x<7

[3, 4, 5, 6]

Read about it in the reference:
http://www.python.org/doc/2.4.2/ref/comparisons.html

Thanks. I was aware of that, I've just never got in to the habbit of
using it..

Will McGugan
 
D

Dave Hansen


As a play on "pawn?" that wasn't the way I first took it (ho-hum...)

How about pyTurk, after the first chess automaton? It seems to be
available.

Regards,

-=Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top