triple repetition

114 views
Skip to first unread message

Daniel Kang

unread,
Oct 26, 1997, 2:00:00 AM10/26/97
to

After a few months of not doing anything, I'm finally back to my
chess programming project. I decided to write a new program because
of the inflexibility of my previous design and the general slowness
of pascal compiler. Anyways, I just wonder how other people handle
triple repetiotion. The only idea I came up with was storing all
previous positions after the last irreversible move such as a pawn
move or a capture.

Is this the best way possible?

Thanks in advance

hoping that someone would reply to my question,
><><><><><><><><><><><><><><><><><><><><><><><
Daniel Kang - An 11th grader at SIS (Seoul International School)
who's interested in getting into college after completing junior
year
<><><><><><><><><><><><><><><><><><><><><><><>
My return address has been set invalid because of an increasing
number of unwanted junk mails. Please take out a period between
dan and kang. Thanks.
><><><><><><><><><><><><><><><><><><><><><><><
Visit Model World Government page at
http://www.geocities.com/CapitolHill/Lobby/2547/


Ronald de Man

unread,
Oct 27, 1997, 3:00:00 AM10/27/97
to

"Daniel Kang" <dan....@nuri.net> writes:

>After a few months of not doing anything, I'm finally back to my
>chess programming project. I decided to write a new program because
>of the inflexibility of my previous design and the general slowness
>of pascal compiler. Anyways, I just wonder how other people handle
>triple repetiotion. The only idea I came up with was storing all
>previous positions after the last irreversible move such as a pawn
>move or a capture.

>Is this the best way possible?

If you have a hashtable, you will probably have a hashkey for
each position. You can store these hashkeys instead of the whole
position for your repetition check.

And to avoid having to look through this list at each node, you might
want to add a small table indexed by say the lowest 10 bits of your
hashkey. You increase the entry corresponding to the current position
after each makemove and decrease it before each unmakemove. As long
as the entry value is at most 2, you do not have to loop through
the list, since this position has occurred at most 2 times.
(Actually, you may sometimes want to score positions that have occurred 2
times as a draw.)
You clear this list after each irreversible move.

Of course, if you do not have a hashtable yet, it would be a good idea to
implement one. You can start by implementing a hashkey.

>Thanks in advance

Hope this helps,

Ronald de Man


Reply all
Reply to author
Forward
0 new messages