New Python chess module

Discussion in 'Python' started by Will McGugan, Sep 29, 2005.

  1. Will McGugan

    Will McGugan Guest

    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
    --
    http://www.willmcgugan.com
    Will McGugan, Sep 29, 2005
    #1
    1. Advertising

  2. > 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

    --
    Pekka Henrik Karjalainen
    who still occasionally writes if (test): because of all the C
    Pekka Karjalainen, Sep 30, 2005
    #2
    1. Advertising

  3. Will McGugan

    Will McGugan Guest

    Pekka Karjalainen wrote:

    >
    > 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
    --
    http://www.willmcgugan.com
    "".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in
    "jvyy*jvyyzpthtna^pbz")
    Will McGugan, Sep 30, 2005
    #3
  4. Will McGugan

    Will McGugan Guest

    There is a new version if anyone is interested...

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

    It contains optimizations and bugfixes.

    Can anyone suggest a name for this module? pyChess is already taken...


    Will McGugan
    --
    http://www.willmcgugan.com
    "".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in
    "jvyy*jvyyzpthtna^pbz")
    Will McGugan, Sep 30, 2005
    #4
  5. Will McGugan

    Tim Churches Guest

    Will McGugan wrote:
    > There is a new version if anyone is interested...
    >
    > http://www.willmcgugan.com/chess.py
    >
    > It contains optimizations and bugfixes.
    >
    > Can anyone suggest a name for this module? pyChess is already taken...


    Pyawn???

    Tim C
    Tim Churches, Sep 30, 2005
    #5
  6. Will McGugan

    Dave Hansen Guest

    On Sat, 01 Oct 2005 06:27:01 +1000, Tim Churches
    <> wrote:

    >Will McGugan wrote:
    >> There is a new version if anyone is interested...
    >>
    >> http://www.willmcgugan.com/chess.py
    >>
    >> It contains optimizations and bugfixes.
    >>
    >> Can anyone suggest a name for this module? pyChess is already taken...

    >
    >Pyawn???


    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
    --
    Change is inevitable, progress is not.
    Dave Hansen, Sep 30, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Will McGugan

    Chess module blog

    Will McGugan, Jun 18, 2006, in forum: Python
    Replies:
    1
    Views:
    728
    faulkner
    Jun 19, 2006
  2. Paolo Pantaleo

    Python & chess

    Paolo Pantaleo, Aug 24, 2006, in forum: Python
    Replies:
    5
    Views:
    547
    Paul Boddie
    Aug 24, 2006
  3. Varun Hiremath
    Replies:
    1
    Views:
    457
    Will McGugan
    Sep 18, 2006
  4. New Chess Module

    , Mar 15, 2007, in forum: Python
    Replies:
    2
    Views:
    408
  5. Oscar Benjamin

    Re: First attempt at a Python prog (Chess)

    Oscar Benjamin, Feb 13, 2013, in forum: Python
    Replies:
    0
    Views:
    136
    Oscar Benjamin
    Feb 13, 2013
Loading...

Share This Page