Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: boundschecking

Author: Uri Blass

Date: 01:13:53 11/05/02

Go up one level in this thread


On November 04, 2002 at 15:18:04, Severi Salminen wrote:

>>>>__int64 rand64()
>>>>{
>>>>	int a,b,c,d,e;
>>>>	a=rand();
>>>>	b=rand()<<15;
>>>>	c=rand()<<30;
>>>>	d=rand()<<45;
>>>>	e=rand()<<60;
>>>>
>>>>	return a^((__int64)b)^((__int64)c)^
>>>>		((__int64)d)^((__int64)e);
>>>>}
>>>
>>>Under most systems, d and e will be zero.
>
>A few points. As Dieter said, the above is wrong, because of too late type
>casts. Secondly why do you use XOR? Why not OR, the result is about the same? OR
>has a definite sequence points and can be used like in your original rand64():
>
>unsigned __int64 rand64()
>{
>    return (ui) rand()|(ui)rand()<<15|(ui)rand()<<30 //and so on...
>}
>
>The above should work in debug and release modes similarily. And you should read
>the topic "precedence of operators" in C docs or search with google. That way
>you can be sure when you need parentheses. Of course one should use parentheses
>whenever that makes things look more logical.
>
>>It still does not explain the crush that I have.
>
>Oh, Uri is in love  ;)
>
>>Movei does not use hash tables to prune the tree and it is not supposed to crush
>>when it get bad numbers in the hash.
>>
>>It should only be slower because of bad order of moves but the new numbers that
>>I get with your function when I only change signed to unsidned are almost the
>>same as the old number so I do not believe that the numbers were
>>0's.
>
>Impossible to tell what is the cause. But by making the above corrections,
>you'll be able to narrow it down step by step. 1st check if it is because of
>hash tables and then start tracking it down. ASSERTS() would most likely help
>here also. Very likely you have out of bound problem again. Or something
>similar: uninitialize variable etc.

Yes I find problems with hash tables.
I decided simply to fill the zobristkey array with 0's for debugging.

The program should not crush.

In the latest version I store the number of legal moves in the hash tables and I
found one bug.

If the number of legal moves is 0 I return mate or draw score without
generating all the legal moves(I change it to generate all the legal moves when
the number of moves is 0).

There seem to be more bugs because even after correcting the problem movei crush
with 0's in the zobrist array.

Uri



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.