Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Move Generator

Author: Richard Pijl

Date: 02:33:30 12/20/02

Go up one level in this thread


On December 20, 2002 at 05:19:18, Uri Blass wrote:

>On December 20, 2002 at 04:33:13, Gerd Isenberg wrote:
>
>>On December 20, 2002 at 04:12:20, Uri Blass wrote:
>>
>>>On December 20, 2002 at 03:37:09, Gerd Isenberg wrote:
>>>
>>>>On December 19, 2002 at 18:49:56, Dann Corbit wrote:
>>>>
>>>>>On December 19, 2002 at 18:47:22, Joshua Haglund wrote:
>>>>>
>>>>>>Anyone know of a good site(s) for the programming of a (legal) move generator?
>>>>>
>>>>>You'll find a lot more help looking for a pseudo-legal move generator.  I don't
>>>>>think anyone makes a strictly legal move generator (maybe Uri does...)
>>>>
>>>>I do it in IsiChess and i guess a lot of bitboarders too.
>>>>
>>>>Gerd
>>>
>>>I do not think that it is something special for bitboarders.
>>>I do it without bitboards.
>>>
>>>Uri
>>
>>Yes, sorry Uri.
>>
>>I thought detecting pinned pieces is a bitboard domain, but of course it's
>>independent of the data structure representing the board.
>>
>>Gerd
>
>detecting pinned pieces is something that I do without bitboard and it can be
>improved(also without bitboard) but maybe bitboard can help better.

Reading your post I think it will.
>
>I will explain what I do in this post and explain my ideas of doing it better.
>
>today I have an array pin[64] that tells me for every square if the piece in it
>is pinned to the king.
>
>pin[i] is used only when there is a piece of the side to move in square i(in
>other cases pin[i] is not used so right for today I do not care if the value is
>wronf).
>pin[i]=-1 means that the piece is not pinned.
>pin[i]=0 means that the piece is pinned to the same file
>pin[i]=1 means that the piece is pinned to the same rank
>pin[i]=2 or pin[i]=3 means that the piece is pinned in diagnols.

Or use 4 bitboards. One for each pin direction
>
>I also has a varaible pinnumber[ply] that tells me the number of piece that are
>pinned.
>
>Adding this varaible helped to do movei sligthly faster.
>
>when pinnumber[ply]=0 I can save the time of looking in pin[i] so when I undo
>moves and pinnumber[ply]=0 I do not care to update the pin array.
>
>the varaible pinnumber[ply] also help in the search algorithm but I still do not
>like my data structure because when a piece is pinned I have no easy way to find
>the square of the pinned piece or the value of the pinned piece and the only way
>for me is simply a loop on the piece list.

Bitscan on the four bitboards should be faster than that.
Or add a fifth bitboard which contains all pinned pieces (independent of pinning
direction) if you don't care about the direction

>I think it may be better if I replace the varaible pinnumber[ply] by
>pininfo[ply] because in 99% of the cases it may be possible to compress all the
>information about pins to one 32 bit integer.
>
>It is possible that in that case I do not need the array pin[64] because usually
>only one or 2 pieces are pinned and there is no problem to store the information
>in one 32 bit number.
>
>Maybe storing information about pins of both sides can be even faster but I
>decided not to do it in the near future and I think that checking not to have
>bugs in the move generator after doing it is not a simple task(I did things that
>may be even more complicated and my move generator have thousands of C lines but
>I decided that today it is fast enough and I do not like to work estimated time
>of some hundreds of hours to implement pins for both sides and check for bugs).
>
>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.