Go back
Creating a chess engine, a blog

Creating a chess engine, a blog

Only Chess

Z

Joined
14 Dec 06
Moves
568
Clock
14 Dec 06
Vote Up
Vote Down

I've decided to rewrite my chess engine from scratch (more or less), and since blogging is so popular these days I decided to write about my progress.

From scratch to the engine beating me. Let's see if I can do it. 🙂

Feel free to drop by and point out all the errors I'm making.

http://mediocrechess.blogspot.com/

Irax

Joined
06 Aug 05
Moves
42926
Clock
14 Dec 06
Vote Up
Vote Down

It sounds like an intersting project, I wish you luck in it. I wrote a chess program about 12 years ago in Pascal, while at university, after months of work I had a program that worked, could play some basic chess but couldn't checkmate you. Some would say the perfect opponent!

I really should dig it out and have a look at it again!

Z

Joined
14 Dec 06
Moves
568
Clock
15 Dec 06
Vote Up
Vote Down

One common problem with chess engines not being able to mate is they don't recognize that a mate in 1 move is better than a mate in 3 moves.

As long as the mate is within the horizon it can't see the difference between the mates, so it just moves back and forth.

I'll put a in a post about that when I get to the evaluation part.

D
Losing the Thread

Quarantined World

Joined
27 Oct 04
Moves
87415
Clock
15 Dec 06
Vote Up
Vote Down

Originally posted by Zlaire
One common problem with chess engines not being able to mate is they don't recognize that a mate in 1 move is better than a mate in 3 moves.

As long as the mate is within the horizon it can't see the difference between the mates, so it just moves back and forth.

I'll put a in a post about that when I get to the evaluation part.
You can stop that by scoring mate in one slightly higher than mate in 2 and so on, which is going to be easiest to implement by scoring checkmate as (327 + ply_depth_of_search) pawns and subtracting 1 (adding 1) to the score if it is over 326 (beneath -326) just before you return from the alpha-beta function, this way the function treats quicker checkmates as better scoring. Alternatively start iterative deepening from 1 ply.

O

Joined
08 Aug 05
Moves
509
Clock
15 Dec 06
Vote Up
Vote Down

Originally posted by Zlaire
I've decided to rewrite my chess engine from scratch (more or less), and since blogging is so popular these days I decided to write about my progress.

From scratch to the engine beating me. Let's see if I can do it. 🙂

Feel free to drop by and point out all the errors I'm making.

http://mediocrechess.blogspot.com/
Excellent ...I've always wanted to know how to start creating a chess engine, so good on ya mate, I'll be looking forward to this post and your blog!

G

Stockholm, Sweden

Joined
31 Jan 06
Moves
3059
Clock
15 Dec 06
Vote Up
Vote Down

I think bitboards (and rotated bitboards) will be easier to manage in the long run, and they have some properties which are very hard to get with any kind of array implementation.

Just my opinion- might save you some time later on.

Z

Joined
14 Dec 06
Moves
568
Clock
16 Dec 06
1 edit
Vote Up
Vote Down

Yeah I know bitboards has its advantages, but not only is the basic implementation quite complicated, they are also a whole other way of thinking in terms of move generation etc.

Most programmers starting a chess engine would first think of a basic array to represent the board, and the 0x88 scheme is an extension to that. Bitboards are a whole other deal.

So for my engine (being a source of learning as well) I think 0x88-representation is more suited.

Perhaps I'll move on to a bitboard engine after this... 🙂

JoR
Scotch addict

Joined
13 Jun 05
Moves
15520
Clock
16 Dec 06
Vote Up
Vote Down

I wrote one in 1986, in Z80 assembler. It beat me.

Irax

Joined
06 Aug 05
Moves
42926
Clock
16 Dec 06
Vote Up
Vote Down

Originally posted by John of Reading
I wrote one in 1986, in Z80 assembler. It beat me.
That's pretty impressive! especially considering the memory restriction you'd have been under. How much memory did it have? 2K? 5K?

And my second question is, were you any good at chess in 1986?

JoR
Scotch addict

Joined
13 Jun 05
Moves
15520
Clock
16 Dec 06
Vote Up
Vote Down

My code and data had to fit in about 32K.

How strong was I then? Good question! I never played regularly until joining RHP, so my first few games here might be a good indication of my strength then. 1400 in RHP terms? I've never had an OTB rating.

Z

Joined
14 Dec 06
Moves
568
Clock
16 Dec 06
Vote Up
Vote Down

A small program..

http://home.hccnet.nl/h.g.muller/max-src2.html

2000 characters, and still playing with all rules etc. Some kind of record I'm sure. 🙂

Z

Joined
14 Dec 06
Moves
568
Clock
18 Dec 06
Vote Up
Vote Down

I've added a bunch more posts, got FEN-strings up and running etc.

Let me know if you're following the blog (through comment or e-mail), always nice with some feedback.

N

Joined
07 Mar 05
Moves
2255
Clock
18 Dec 06
Vote Up
Vote Down

I am with you.

Z

Joined
14 Dec 06
Moves
568
Clock
24 Dec 06
Vote Up
Vote Down

Pseudo-legal move generation up and running. Soon I can start working on the search algorithm!

Z

Joined
14 Dec 06
Moves
568
Clock
07 Jan 07
Vote Up
Vote Down

First beta version released. The engine is playing pretty darned well considering the simple evaluation it uses at the moment.

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.