x
Chess - Play & Learn

Chess.com

FREE - In Google Play

FREE - in Win Phone Store

VIEW

Programming Chess #1

Lopsidation
Nov 22, 2010, 7:20 PM 0

How should a computer approach chess?

In this series, I- who, it should be disclaimed, actually has no idea how top chess programs work, nor do I know any programming concepts beyond recursion- will try to figure this stuff out.

The most obvious option is creating a search tree to look ahead a few moves in the game. We'll need to know how far the computer should look, so let's see how fast it can calculate.

This code:

mailbox = 4

for i in 1..5000000

  mailbox = (mailbox^2)%178349507139

end

ran in 20 seconds, so with the optimistic viewpoint that making a move is as easy as squaring a number, let's say a computer can analyze 15 million positions in a minute. With the average of ~30 moves per side, looking ahead three moves would take only

30*30*30*30*30*30/15,000,000 = 48.6 minutes. I could play 1. d4, go for a five-mile run, and get back in time for the computer's response.

Alright! As you can see, even our simple model is already far better than Rybka or Deep Blue: neither of them would never evaluate clever off-the-beat moves like this program would:

 

Would Rybka ever be prepared for these lines? No, and that's why our program- let's call it Cirnovelty- is currently the best on the market.

Also, consider this: at the computer's rate, I could finish the Boston Marathon before the opening was over; what other chess program lets you get in this much physical exercise along with the mental exercise?

 

Next time: some improvements! -and complications.

Online Now