pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Python Chess

Python Chess - 0.5

Steve Osborne (yakinikuman)

Tags:

Description

Python Chess is a chess game (duh) for player vs. player, player vs. AI, or AI vs. AI. Uses Tkinter to get initial game parameters. Uses Pygame to draw the board and pieces and to get user mouse clicks. Run with the "-h" option to get full listing of available command line flags. See the website for detailed development history.

Links

Home Page: http://uniformlyuninformative.wordpress.com/games/python-chess/
Source: http://sites.google.com/site/purplesaguaroinc/myfiles/PythonChess_v0.5.zip

Screenshot


click to view original size

Releases

Python Chess - 0.7 - Apr 28, 2009
Python Chess - 0.6 - Apr 21, 2009
Python Chess - 0.5 - Apr 16, 2009

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

April 28, 2009 12:44am - Ken Seehart - nickname: (kenseehart)
Nice program. I recommend learning algebraic notation. While it is reasonable to assume that many users will not know algebraic notation, some will. Since this program uses coordinates, even if you don't use algebraic notation, you should at least name the squares in a manner consistent with algebraic notation. Specifically, the file should precede the rank, as in 'e4' instead of '4e'.

See http://www.fide.com/fide/handbook?id=125&view=article Appendix E, especially section E7.
April 26, 2009 5:48pm - C. J. Williams - nickname: (cjw) - 4/5
I like the look of your board and have played a couple of games.

Problems (1) No provision for castling.
(2) Unable to generate an exe file.
(3) Possible problem with en-passant move, not checked.

It's looking good. Using Windows XP Python 2.6.2

Colin W.
April 22, 2009 12:00pm - patrick mullen - nickname: (saluk)
Well, class: and class(object): are not the same in python2.5 and below. If you inherit from object, it is "new style", and things like super() or def getattribute work right; if you don't inherit from object it is "old style", and none of those work. So to be safe, if you were using old style before (not inheriting from object) you should convert it to "Class:". In python2.6 and up, there are no old-style, so "class:" already inherits from object. More info here: http://www.python.org/doc/newstyle/

It's nice to see an attempt at chess ai in python, one of the most heated places for ai algorithms to duke it out. I'm interested in looking at the source and seeing how you did it, it seems pretty good to me.
April 16, 2009 7:56pm - Steve Osborne - nickname: (yakinikuman)
Thanks for finding those errors! I'll incorporate the fixes in the next version.
April 16, 2009 5:23pm - Jordan Trudgett - nickname: (tgfcoder) - 4/5
A few things about compatibility:
1. Python 2.4.4 (or at least my one) doesn't like "Class():". It will only take "Class(object):" or "Class:" (both of which have the same effect I believe.)
2. The three squares have a ".PNG" suffix, rather than the expected ".png". This causes troubles when trying to load them on my Linux computer.
3. For some reason, rendering text fails when antialiasing is off. Which raises an exception. I think this happens to some other people too.

After changing those, it worked fine :)

I would have liked to see the colour of the square underneath the cyan bit, but that's a bit tricker to do. Also, when you exit, you call exit(), which is both the name of a function and the name of a string (d'oh.) So I get this:
....exit()
TypeError: 'str' object is not callable

the string 'exit' defaults to:
Python 2.4.4 (#2, Oct 22 2008, 20:20:22)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
'Use Ctrl-D (i.e. EOF) to exit.'

so you probably don't have a function exit().

You should quit with pygame.quit() followed by sys.exit(0)-- for maximum compatibility.

Python 2.4.4 (#2, Oct 22 2008, 20:20:22)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.exit(0)

Looking at your AI functions, they look pretty good
.The defensive AI put up a good fight :)
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Aug 26, 2014

Aug 22, 2014

Aug 21, 2014


Aug 19, 2014

Aug 18, 2014

Aug 2, 2014


Jul 28, 2014

Jul 22, 2014

Jul 21, 2014

Jul 20, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)