programming a chess game with diiferent moves

Chess programming lessons for beginners and intermediate

Moderator: Andres Valverde

programming a chess game with diiferent moves

Postby MrG » 14 Feb 2012, 13:57

How can I program a chess games with different moves
MrG
 
Posts: 1
Joined: 14 Feb 2012, 00:19

Re: programming a chess game with diiferent moves

Postby crystalclear » 17 Oct 2012, 00:06

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.
crystalclear
 
Posts: 91
Joined: 22 Sep 2011, 14:19


Return to Chess Programming Lessons

Who is online

Users browsing this forum: No registered users and 1 guest