Random command

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Random command

Post by Kempelen »

I have a baby engine ready to test. Few feautures but nice. Maybe you have imagine it because I am making lots of questions in the forum. :)

When I test it with other engines, it happens that with a few of them the same game is played again and again. This appears to me to be logic, and I am trying to figure out how to solve it.

I have seen that by xboard the "random" comand is sended, so I would like to take adventage of it in order to avoid this problems. I have thought on introduce a random value in sorting move function, so in time levels the move will no be the same. But I dont see how to do it property. I mean, that if a different move have been done compared to normal conditions, the the random feature will turn off.

How can I implement this feature? what are the strategies availables? it would be preferable if the solution will work on fix depth levels too and not only in time levels.

thx in advance
User avatar
pedrox
Posts: 1056
Joined: Fri Mar 10, 2006 6:07 am
Location: Basque Country (Spain)

Re: Random command

Post by pedrox »

Maybe instead of introducing something random on the function order, you have to introduce something random but in the evaluation.

On many occasions you have only a good move and the another are bad, so you are forced to play this move. But if you take a small random value in the evaluation, the programme will seek to generate a tree a little different.

Perhaps the program with the turn you can give a random value between 0 and 10-20 centi-pawns.

Pedro
Last edited by pedrox on Tue Apr 01, 2008 8:05 pm, edited 1 time in total.
User avatar
hgm
Posts: 28356
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Random command

Post by hgm »

For consistency you would have to make sure that the same position, when evaluated again, would use the same random. So the random should only be random with respect to starting time of the game.

In Joker I use the hash-key for this purpose, something like

(hashKey^startTime)*FACTOR >> 28

to get a 4-bit random.
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: Random command

Post by Kempelen »

but I think the ideal situation is turn off random when a alternative move has been played with respect to normal one.... so the engine return to play at maximum strength..... any idea?
User avatar
hgm
Posts: 28356
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Random command

Post by hgm »

IMO adding a random value to the evaluation should make the engine stronger. But I have no data accurate enough to prove it.
User avatar
Bill Rogers
Posts: 3562
Joined: Thu Mar 09, 2006 3:54 am
Location: San Jose, California

Re: Random command

Post by Bill Rogers »

How about randomly selecting a different opening for each game, such as e4, d4 or c4 ? Instead of having your engine start with its normal move selection have it make its first move from a short list like the one proposed, this will give you slightly different plays to start with. Otherwise create a small opening book.
Bill
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: Random command

Post by Kempelen »

That looks like a good solution, but I have not write the opening book code yet, I dont plan to do it in short. I want to make a good opening eval before use the book.
Dirt
Posts: 2851
Joined: Wed Mar 08, 2006 10:01 pm
Location: Irvine, CA, USA

Re: Random command

Post by Dirt »

Kempelen wrote:That looks like a good solution, but I have not write the opening book code yet, I dont plan to do it in short. I want to make a good opening eval before use the book.
Then use a set of opening positions. Even if you don't support that feature yet, it is far easier to add.
Harald Johnsen

Re: Random command

Post by Harald Johnsen »

I don't know why you want random moves in engine-engine games.
I can not understand how you are going to debug your engine (or simply understand what it is doing) if you are unable to reproduce the analysis of a position.

HJ.
Tord Romstad
Posts: 1808
Joined: Wed Mar 08, 2006 9:19 pm
Location: Oslo, Norway

Re: Random command

Post by Tord Romstad »

pedrox wrote:Maybe instead of introducing something random on the function order, you have to introduce something random but in the evaluation.
That's what I do. At the beginning of a new game, I re-initialize my piece square tables. If randomization is enabled, a small random number is added to every entry in the tables.

Tord