Heywood Congress

For details of the Heywood Chess Congress visit www.heywoodcongress.org.uk.

Login Form

When I wrote my first program it did everything - GUI, clocks, move-selection, design of the pieces etc. Whilst fun, this was essentially a waste of time.

Commercial chess programs make a difference between the GUI etc. and the engine (the bit that actually plays the game) - and I think that the best way for an amateur is to take the same approach. This way you can concentrate on the engine, and borrow the rest. It also means that you can easily interface your engine with other programs, so that next time you are watching Anand play for the World Championship you aren't restricted to using Houdini or Rybka to analyse the game - you can use your own engine instead! It will also allow you to match your engine against other engines, and even to let your engine take on the world via ICC, FICS etc.

Which interface?
There are a few interfaces around (e.g. UCI) which you can explore. I chose Winboard/Xboard, because it's simple and free. You can download it from various places on the internet, depending on whether you want a Windows or Linux version

Details of the interface are available from http://home.hccnet.nl/h.g.muller/engine-intf.html - have a look to see if it's for you. The bits to concentrate on are sections 8 and 9 - 'Commands'.

How your engine will work with Winboard:
You write a chess-playing program, in whatever language takes your fancy. Write it so that it runs at the shell prompt (i.e. at the C:\> prompt in Windows, #, $ etc. prompt in Unix/Linux etc.), not in a GUI. My first chess program was written in Java, but I ported it over to c to try to make it faster. If you choose c, don't ask me for advice on the language - I trained as a COBOL programmer...

When I run my engine (it's called 'grinder' by the way) at the shell prompt, you just get a blank screen - it's waiting for you (or the opponent) to do something - you're White, the engine is Black. Let's say you are happy to play White - it's your turn, so type in a move. You type in the moves in a simplified algebraic manner, so type e2e4 and see what happens. What happens is the grinder will have a think, and reply with move e7e5. We're off - let's move in classical manner - type in g1f3. Grinder will respond with move b8c6 - you type f1b5, and just like Morphy grinder replies with move a7a6.

It should be obvious that this approach lends itself to an interface we've already got - the mark-one eyeball and a chess set.

Homework:
1. Write a program that does the above - sits and waits for you to type in e2e4 and replies move e7e5 etc.

2. Download Winboard/Xboard, and get it running (it comes with a copy of crafty, so you can play against it if you want)

3. Now get Winboard to play your new engine - you'll have to play White of course, and open P-K4, but if you stick to the script you'll at least get the impression that your engine can play chess.

Once you succeeded with these tasks, you're ready to start getting your engine to really play chess.

Step 1 is easy, if you have a bit of programming knowledge.  Just select your language of choice, and write a program like this (pseudo-code):

input x

output "e7e5"

input x

ouput "b8c6"

input x

output "a7a6"

input x

output "resign"

Once you've got this working at the C:\> prompt (or # prompt etc.), and then got it to work with Winboard/Xboard, you're ready for the next step.  If you need any help, contact me at the club.