Programmer wanted to write chess game for an exhibition

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

GameOn

Programmer wanted to write chess game for an exhibition

Post by GameOn »

I hope I can post this here, if not then I do apologise.

I work for a art gallery and we tour an exhibition on the history and culture of computer and video games around the world, it has been running for 10 years. Next year for six months it will in Toronto, Canada.

I am looking to improve our early games section as well as add a chess section to the show and I am looking for someone that can write me a program that will run under Linux (preferable something self booting) on a low end Net top computer or a Raspberry Pi that will play three early examples of chess games.

These being

El Ajedrecista - An electromechanical game that would play the rook king endgame.
Turochamp - Chess program based on Alan Turings chess algorithm
Los Alamos - Early 6x6 chess game on the Maniac 1
(I know Charles Shannon did create a realy chess computer sometime in the 50s but there does not seem to be too much information on this ditto with Machiavelli).

I know I could use a chess engine to play most of these but I need it to be idiot proof so it can be used by the general public and run with a few buttons (choose game, new game, rules and a history button). The rules button brings up the rules for the game and the history button brings up some text giving some history.

I do not have a huge budget so it needs to be done for free (although credit will be given) or as cheaply as possible. Worse comes to the worse then just El Ajedrecista woud be fine (as this should be simple with it's six rules).

If anyone can help then please message me for more details.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Programmer wanted to write chess game for an exhibition

Post by ilari »

GameOn wrote:I do not have a huge budget so it needs to be done for free (although credit will be given) or as cheaply as possible.
LOL. I wish you luck.
User avatar
hgm
Posts: 27817
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Programmer wanted to write chess game for an exhibition

Post by hgm »

I am not sure what exactly you have in mind. What do you mean by 'examples of Chess games'? Do you use 'Chess game' here in the sense of 'AI opponent'? Do you want people to be able to play against these opponents, where they are fully free to choose their own moves?

If so, it seems that what you need is a GUI and 3 different engines. There already exists a (free) engine to play Los Alamos Chess under WinBoard I thought there also existed an engine 'Turing' that emulates Turing's paper algorithm, but it could be that this is only usable with Chess base. Almost any engine can play K+R vs K, but I suppose this one would have to play in a very peculiar way to mimic the same algorithm as El Ajedrecista. This probably does not exist.

I think the main challenge would be to prevent people getting access to the Operating System, after which they could pretty much wreck any havoc they like. So I guess you plan to deny them access to the keyboard, to prevent them typing Ctrl+Alt+Del, Alt+Tab etc., and have them operate a screen-filling Chess board only by mouse? (And then it still would have to be adapted that it does not react to the window-close or minimize buttons so the user could uncover stuff behind it. And somehow it should also be prevented they can click on the task bar. I am not sure if all this can be done. OTOH, it does sound like a reasonably general requisite for exhibitions and such, so perhaps there is standard software that allows you to run something in such a way the user cannot activate any other system function then what you would want to let them run.

If this 'encapsulation' problem can be solved, what you would need is a GUI and the 3 mentioned engines. Now XBoard is open source, and very easily adaptable to what you want. It would be totally trivial do make a version that disables all menu functions, or leaves only a single menu with items 'Play against Turing', 'Play against El Ajedrecista' and 'Play Los Alamos Chess'. It would also be possible to make buttons for that above or below the board, in stead of a drop-down menu. Do you want them to be able to pick the color they play?

Then all you would need is the engines. For Los Alamos you can just take the one that exists. El Ajedrecista would probably have to be built, but this could be easy. (Provided you can come up with the exact algorithm it used.) You could also cheat, and just let any engine play KRK to give people the flavor. I don't know about TuroChamp. If the existing one is not usable under XBoard, writing one from scratch might be more difficult.

In addition to the three you mention you could also offer the World's currently smallest Chess program (Toledo nanoChess) as opponent. And the World's current strongest Chess program (Houdini) set to think about 1 sec/move.
bpfliegel
Posts: 71
Joined: Fri Mar 16, 2012 10:16 am

Re: Programmer wanted to write chess game for an exhibition

Post by bpfliegel »

I saw a Turochamp emulation/presentation earlier:
http://www.theverge.com/2012/6/26/31190 ... y-kasparov

I'm checking out if there is anything on El Ajedrecista.
User avatar
hgm
Posts: 27817
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Programmer wanted to write chess game for an exhibition

Post by hgm »

I found this other link about TuroChamp: http://uscfsales.wordpress.com/2011/07/ ... interface/

It seems that it is indeed an engine in ChessBase proprietry format, so it is not of much use.
bpfliegel
Posts: 71
Joined: Fri Mar 16, 2012 10:16 am

Re: Programmer wanted to write chess game for an exhibition

Post by bpfliegel »

Gerd has an article in the CPW, also describing the basic logic:
http://chessprogramming.wikispaces.com/El+Ajedrecista

I suppose it's also the full logic, but I'm uncertain as I cannot find the cited articles.

Would not be hard to make a UCI/WB engine out of it.
User avatar
hgm
Posts: 27817
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Programmer wanted to write chess game for an exhibition

Post by hgm »

bpfliegel wrote:Would not be hard to make a UCI/WB engine out of it.
This is what I figured. I will have a look at the link. Via CPW I also found this link to what seems a reproduction of the text of Turing's original paper.

I had never actually read this paper before, but what he describes looks amazingly like a conventional Chess engine. It introduces the concepts of full-width search (two ply), quiescence search, stand-pat, material & mobility evaluation, King safety. Basically all that is needed to modify a conventionall Chess engine into TuroChamp is to replace the evaluation.
bpfliegel
Posts: 71
Joined: Fri Mar 16, 2012 10:16 am

Re: Programmer wanted to write chess game for an exhibition

Post by bpfliegel »

Exciting stuff!
User avatar
hgm
Posts: 27817
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Programmer wanted to write chess game for an exhibition

Post by hgm »

Indeed, El Adrecista is a very simple algorithm. (I guess it can be so because it cannot handle positions with bare K behind the Rook. I have adapted Fairy-Max to play it, by having it call a different routine to make its own move than normally. (I left in the other one for legality checking and result determination.) This seems to do it:

Code: Select all

Zone(sq)
int sq;
{
  sq &=15;
  return 2*&#40;sq >= BW-3&#41; | &#40;sq < 3&#41;;
&#125;


DoKRK&#40;k,q,l,e,E,z,n&#41;

int k,q,l,e,E,z,n;

&#123;
 int wK=S, wR=S, bK=S, r, f, p, x, y, u, H, t=0;

 if&#40;k&#41; &#123;K=L=0; return -I;&#125; // black to move, resign

 // locate pieces
 for&#40;r=0; r<S; r+=16&#41; for&#40;f=0; f<BW; f++) &#123;
  p = b&#91;r+f&#93;&31;
  if&#40;w&#91;p&15&#93;<0 && !&#40;p&16&#41; && wK==S&#41; wK = r+f; else
  if&#40;w&#91;p&15&#93;<0 &&  &#40;p&16&#41; && bK==S&#41; bK = r+f; else
  if&#40; p==6     && !&#40;p&16&#41; && wR==S&#41; wR = r+f; else
  if&#40;p&#41; &#123;K=L=0; printf&#40;"bad piece %x at %x\n",p,r+f&#41;; return -I;&#125; // Not KRK, resign
 &#125;

 if&#40;Zone&#40;wR&#41; & Zone&#40;bK&#41;) &#123; // determine if Rook should be moved sideways
  x = wR; y = wR & ~15; 
  if&#40;Zone&#40;wR&#41; & 1&#41; y |= BW-1;
 &#125; else &#123; // R and k laterally far apart
  if&#40;&#40;bK & ~15&#41; < &#40;wR & ~15&#41; - 16&#41; &#123; // empty rank&#40;s&#41; between R and k
   x = wR; y = x-16;
  &#125; else &#123; // k borders Rook rank
   if&#40;&#40;bK & ~15&#41; < &#40;wK & ~15&#41; - 32&#41; &#123; // two or more ranks between K and K
    x = wK; y = x-16;
   &#125; else &#123; // one rank between K and k
    p = &#40;wK & 15&#41; - &#40;bK & 15&#41;;
    if&#40;!p&#41; &#123; // opposition
     x = wR; y = x-16; // check him
    &#125; else if&#40;p & 1&#41; &#123; // waste tempo with Rook
     x = wR; p = x & 15;
     if&#40;p == 0&#41;    y = x+1; else
     if&#40;p == BW-1&#41; y = x-1; else
     if&#40;p < BW/2&#41;  y = x-1; else
                   y = x+1;
    &#125; else &#123; //
     x = wK; y = x + &#40;p<0 ? 1 &#58; -1&#41;;
    &#125;
   &#125;
  &#125;
 &#125;

 b&#91;y&#93; = b&#91;x&#93;; b&#91;x&#93; = 0;       // perform move
 K=x; L=LL=y; Q=-500; O=S;    // return move to caller &#40;and eval score, e.p. square&#41;
 u = b&#91;H=y&#93;; J+=J&#40;0&#41;;Z+=J&#40;4&#41;; // update hash keys to prevent false rep-draw calls elsewhere

 return l;

&#125;
It does need a bit of special handling, though. You cannot just put up any position, but the bare King has to be in front of the Rook, and the other King behind it. So the user cannot be allowed to set up the full position.
User avatar
hgm
Posts: 27817
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Programmer wanted to write chess game for an exhibition

Post by hgm »

Btw, the Los Alamos Chess engine (by Ferdinand Mosca) is called Liit, and can be downloaded from here. It seems to be only available as Windows binary, but I suppose it could run on Linux under wine.

Of course this might not be what you want: it plays Los Alamos Chess, all right, but it is not the original Los Alamos program. It is a modern program, that plays by the rules for this variant, and is probably unbeatably strong.