views:

300

answers:

3
+3  Q: 

chess AI for GAE

I am looking for a Chess AI that can be run on Google App Engine. Most chess AI's seem to be written in C and so can not be run on the GAE. It needs to be strong enough to beat a casual player, but efficient enough that it can calculate a move within a single request (less than 10 secs).

Ideally it would be written in Python for easier integration with existing code.

I came across a few promising projects but they don't look mature:

+1  A: 

This problem is a poor match for the GAE architecture, which is designed for efficient CRUD operations, and not CPU-intensive tasks. In practice, anything that takes more than a few tens of milliseconds per request will blow out your CPU quota pretty quickly.

Jonathan Feinberg
still, the free CPU quota is very generous at 6.5 hours. If the average AI move took ~3 CPU seconds (some are on book) and there are ~40 moves / game, then that would give me ~200 games / day, which is more than I need. (Hope my assumptions are correct)
Plumo
Actually you can create strong engines with not that much cpu power, if you do it correctly.A good chess engine prunes the tree so heavily, that the sum of nodes searched for, say, depth 7 is within 1sec of an interpreted language.
Thomas Ahle
If you take more than about 500ms your process gets killed and your user gets an HTTP 500.
Jonathan Feinberg
Where did you read that? The docs say 30 seconds and my experience confirms this.
Plumo
+4  A: 

What's wrong with PyChess? It's pure Python, fairly mature, and will certainly be able to beat a casual player.

It's been a while since I've used PyChess, but a quick glance through some of the source does indicate that you can set a time limit on how long to search for a move.

The PyChess engine that is written in pure Python is in pychess.Utils. Specifically, if you look at pychess.Utils.lutils, you can see for instance the move generator written in Python.

Mark Rushakoff
I had a look at pychess, but the chess engines it uses seem to be C based:http://code.google.com/p/pychess/wiki/ChessEngines
Plumo
thanks for the pointer!
Plumo
@Richard: It does support C engines, through the CECPEngine and UCIEngine classes. However the engine it bundles, and which is used for internal analysis, is written in Python.
Thomas Ahle
@Richard: Also consider to send stuff back upstream, if you make improvements or fixes to the code.
Thomas Ahle
A: 

Richard-

Did you follow through on this? I'd be interested in seeing the GAE code/running project if you've posted it somewhere or are willing to share it.

-Bill

billmag
hi Bill, no my bid wasn't accepted for the project so I dropped this idea. To get started I would look at hcmus-chess (http://code.google.com/p/hcmus-chess/) and blitz chess (http://code.google.com/p/google-app-engine-samples/)
Plumo