Page 1 of 1

programming a chess game with diiferent moves

PostPosted: 14 Feb 2012, 13:57
by MrG
How can I program a chess games with different moves

Re: programming a chess game with diiferent moves

PostPosted: 17 Oct 2012, 00:06
by crystalclear
You can use a random number generator to pick moves from an opening book. Once a game has a different start, it is likely to follow a completely different path.

If you want a program to vary its path during the middle game you can add a small random number to the score returned by evaluate, or choose randomly between moves with the same score in your search function.

Random number functions often use a "seed" value. I experimented with an option in my program to
1. Play the same moves always
2. Play the same moves in a game if the opponent retracts moves and researches, but new games can vary
3. Play varied moves on a research of the same position.

I can do this as follows.
1. Use the hashkey of a position as the seed for its random number. ie predictably random.
2. Use a random game seed combined with the positions hash code.
3. Use a clock value as the seed.

I played with it and it worked, but I never implemented it for anything more than the opening book move choice. The rest of my software is too time-dependent and doesn't play well enough for it to be worth doing.