[Grok-dev] Me Grok Play Chess!

Maurits van Rees m.van.rees at zestsoftware.nl
Sun Apr 15 09:59:33 EDT 2007


Hi Grokkers,

Grok already had a club to hunt mammoths with.  Now he also has a
chess club! ;-)

You can see a demo game here:

http://chess.vanrees.org:15080/game

No thought has been put into dealing with multiple users.  Anyone can
click the 'Start again' button anytime, just when you are unfolding
that masterful end game.  So I would not use this site for serious
games.

The code is here:

https://svn.vanrees.org/svn/opensource/grokchess/trunk

I am not too clear on that buildout thingie, but if you use
grokproject you can create a new project and then put this code into
the src/ dir.

The chess program itself is in the chessmind directory.  You can run
its unit tests by running ./__init__.py.  Add '-v' if you want to see
what is being tested.

The first step has been taken for making a computer player: there is a
method hint(depth=0).  If you give the depth parameter a value of 1,
it takes horribly long already to do the computations.  So a rethink
for that part would be necessary.  Should anyone want to continue
development of chess with Grok, I recommend hooking Grok up with an
existing engine like GnuChess.  Making my own chess program is just
something I wanted to do some time for fun.

But Grok knows all the rules of chess, including promotion, castling
and en passant.  Those last two were by far the most difficult parts
to implement.  Grok lets you know when the game has finished with a
mate or stalemate.  Grok only does not know about stalemate due to the
50 move rule or a third repetition of position.


The Grok part of the application is basically just a browser view.  It
has no tests whatsoever.  Sorry.  When I was building the chess engine
I wondered what a good way would be to make a user interface.  Since I
am working daily with Zope and Plone I thought it would be nice to try
out Grok for this.  I was right! :-D

ME GROK SMASH OTHER PLAYER!

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."



More information about the Grok-dev mailing list