Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: about using killers in Rebel and about programming

Author: Uri Blass

Date: 23:08:37 12/31/02

Go up one level in this thread


On January 01, 2003 at 01:01:24, Robert Hyatt wrote:

>On December 31, 2002 at 20:32:28, Uri Blass wrote:
>
>>On December 31, 2002 at 19:50:43, Robert Hyatt wrote:
>>
>>>On December 31, 2002 at 17:49:52, Uri Blass wrote:
>>>
>>>>From Ed programmer stuff
>>>>
>>>>Killer-One [current ply]      110
>>>>Killer-One [current ply-2]    108
>>>>Killer-Two [current ply]      106
>>>>Killer-Two [current ply-2]    104
>>>>
>>>>I until today used only
>>>>
>>>>Killer-One [current ply]
>>>>Killer-Two [current ply]
>>>>
>>>>I am interested to know if using 4 killers is a new idea or maybe this idea is
>>>>known to be used by other programs.
>>>
>>>It was known in 1975.  Chess 4.0 used this.  You can find it mentioned in
>>>the chess 4.7 chapter of "Chess Skill in Man and Machine."
>>>
>>>We did that in Cray Blitz, but we also did more killers, going back to the
>>>root in fact...
>>>
>>>
>>>
>>>>
>>>>I did try part of the idea that Ed suggested without clear results.
>>>>
>>>>I changed the order of moves in movei to
>>>>
>>>>Killer-One [current ply]
>>>>Killer-One [current ply-2]
>>>>Killer-Two [current ply]
>>>>
>>>>instead of
>>>>
>>>>Killer-One [current ply]
>>>>Killer-Two [current ply]
>>>>
>>>>I found that it is better only in part of the cases and have not clear results
>>>>if it is better or worse than previous order but I had a bug in the
>>>>implementation and I checked killer[ply-2] even in cases when ply-2<0.
>>>>
>>>>It is surprising that the program did not crush and even performed better in
>>>>part of the cases.
>>>>
>>>>I still do not use check bound software.
>>>>I asked in a previous discussion about checking bounds but I solved the
>>>>problem that caused me to ask about it and I also read a claim that if a
>>>>varaible is out of bound the program should crush.
>>>>
>>>>I also looked for a software that will help me under visual C++ but after I
>>>>asked to get it for free evaluation and I only got an email that suggest me to
>>>>contact them by fax or telephone I did not respond(I responded by email but my
>>>>email was blocked for some reason and I decided that the subject is probably not
>>>>very important).
>>>>
>>>>I think now that it may be important because a chess program may even play well
>>>>inspite of the fact that it calls killer[-1] so it is possible that I have more
>>>>mistakes like that.
>>>>
>>>
>>>That probably won't hurt a thing.  That move probably would not pass your
>>>legality check, so even a garbage move would just waste a tiny bit of time
>>>as you notice it is not legal in the current position.
>>
>>Yes but I can still imagine problems.
>>
>>1)If I am unlucky a garbage move may be legal so it can be counterproductive.
>>
>>2)I thought that garbage may do something worse than giving a random
>>number.
>>I thought that if my program try to look at some place that does not exist the
>>program may crush and not give me a random number or may change another array.
>>
>>I also cared not to have -1
>> A[x]=1; and not
>>if (x>=0)
>>A[x]=1;
>
>That doesn't hurt a thing.  a[-1] is one "thing" before a[0].  If a is an
>integer, a[-1] is simply 4 bytes in front of a[0]...
>
>>
>>If you are right then it means that there are cases when I can save time by
>>doing something like
>>
>>A[x]=1; instead of
>>if (x>=0)
>>A[x]=1;
>
>You can do that just so you _know_ what is in front of A.  IE in fortran,
>arrays go from 1 to N, rather than 0 to N-1 as in C.  But in Cray Blitz we
>wanted to reference a[i] where i could be 0, 1, ... and all we did was make
>sure that there was a memory word that could safely be zapped, in front of
>a[1].  We did it like this:
>
>common /x/  dummy, a(10)
>
>a(1) thru a(10) are normal array references.  a(0) actually stores on top of
>"dummy".
>
>
>
>
>>
>>The point is that if I understand correctly then I understand from your post
>>that a[x]=1 when x=-1 can not change relevant information.
>
>No, it can _definitely_ change something, just not exactly what you think it
>is changing.  :)  It will change what is in _front_ of the array.  In C, the
>only way to know what is in front of the array is to put the array in a
>structure, and then put something right in front of that array declaration
>to declare the "dummy" space needed for a[-1].  Or a[-2] if you want to go
>backward even farther.
>
>
>
>>
>>If I assume that the condition x>=0 happen in most of the cases then it seems
>>clear that A[x]=1 is faster.
>
>Correct.  If you know that -1 <= x <= N, then one dummy word in front of the
>array will let you eliminate the test.

This was only thinking about a theoretical case but I found other things in my
code.

In a lot of places in my program
I have a condition like

while (target!=-1&&info[target]==EMPTY)

In most cases target!=-1

I thought that I need to do the && in this order
Do you say that I can change the order without risks?

Suppose that the loop stops in most of the cases because of the fact that
info[target]=EMPTY.

Does it going to do my program faster or maybe the compiler can detect these
cases in profile optimazions?

I thought that even checking the value of info[-1] can give an error or change
some varaible that I do not want.

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.