Author: Alessandro Damiani
Date: 04:48:47 10/25/02
Go up one level in this thread
On October 25, 2002 at 07:41:45, Dave Gomboc wrote:
>On October 25, 2002 at 07:35:13, Alessandro Damiani wrote:
>
>>On October 25, 2002 at 07:19:52, Uri Blass wrote:
>>
>>>On October 25, 2002 at 07:08:13, Alessandro Damiani wrote:
>>>
>>>>>>The implementation of generating moves in chunks is easily done by encapsulating
>>>>>>all work in a method that returns the next move:
>>>>>>
>>>>>> Move nextMove(int ply, ...)
>>>>>>
>>>>>>The value 0 is returned, if there is no move anymore.
>>>>>>
>>>>>>The method nextMove() has a state for each ply: in which generation phase it
>>>>>>currently is. For instance, our move ordering is
>>>>>>
>>>>>> 1. hashmove
>>>>>> 2. winning captures
>>>>>> 3. killer 1
>>>>>> 4. killer 2
>>>>>> 5. equal captures
>>>>>> 6. non captures
>>>>>> 7. losing captures
>>>>>>
>>>>>>We define the following phases:
>>>>>>
>>>>>> PHASE_HASHMOVE 0
>>>>>> PHASE_GENCAPTURES 1
>>>>>> PHASE_POSCAPTURES 2
>>>>>> PHASE_KILLER_1 3
>>>>>> PHASE_KILLER_2 4
>>>>>> PHASE_EQUALCAPTURES 5
>>>>>> PHASE_GENNONCAPTURES 6
>>>>>> PHASE_NONCAPTURES 7
>>>>>> PHASE_NEGCAPTURES 8
>>>>>
>>>>>Today I also have phases nit clearly less phases than you.
>>>>>
>>>>
>>>>As I stated above, this is just an example. I have got more phases.
>>>>
>>>>Just to be clear: only phase 1 and phase 6 generate moves (in this example).
>>>
>>>I understand now but I still do not understand.
>>>You do not generate moves in phasehashmove?
>>>
>>>what do you do exactly
>>>Do you say that
>>>you check if the hash move is legal and if it is legal you generate it?
>>>
>>>What do you do in phase 1?
>>>Do you compare all moves with the hash move to promise that you do not have it
>>>again in your list or do you generate it again and only in the sort move you
>>>ignore it.
>>
>>Below is an excerpt from my engine Fortress.
>>
>>Just to make you understand my notation: I emulate OO in C. So I access method
>>isValid() of module Move by writing Move_isValid().
>>
>>--- nextMove(ply, ...) ---
>>
>> ...
>> Move m;
>>
>> switch (phase[ply]) {
>> case PHASE_HASHMOVE:
>> phase[ply]= PHASE_GENCAPTURES;
>>
>> // establish invariant: last[ply] points behind the last entry in the
>> // move list
>> MoveGenerator_last[ply]= MoveGenerator_last[ply-1];
>>
>> m= MoveGenerator_hashMove[ply];
>>
>> if (Move_isValid(m))
>> return m;
>>
>> // it applies: !Move_isValid(m)
>> // continue with next phase:
>>
>> case PHASE_GENCAPTURES:
>> ...
>>
>>--------------------------
>>
>>You notice the following:
>>- I don't generate the hashmove, since I get it from the hashtable
>>- I test for validity of the hashmove with method isValid(Move m)
>>
>>The same method is used for killer moves, since they already exist. I don't need
>>to generate them.
>>
>>As you can see, this is optimal: if the hashmove produces a beta cut-off no move
>>is generated. Method isValid() is fast with bitboards. ;)
>>
>>Alessandro
>
>I think one thing that Uri wants to know is how you avoid making sure that every
>move that you generate later is not a) the hash move and b) any other move that
>you've already searched. If I understand his situation correctly, he doesn't
>have a way to do this efficiently at the moment.
Since the moves in the list are not ordered a priori the fastest way is a linear
search for moves already searched like hashmove. These moves are removed from
the list. In the example above I do this operation in phase 1 and 6, just after
move generation.
Alessandro
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.