Procedure TentativeMove |
Input: |
steps, the steps will be searched. |
PS: the initial pieces-state. |
isFL: whether it is the first level of recursion. |
Output: |
maxEva: the maximum value of evaluation. |
Method: |
(01) let allFC be the set of falling checkers’ coordinates; |
(02) let cSC be the coordinate of starting checker; |
(03) let cFC be the coordinate of falling checker; |
(04) let CS be the checkers-state; |
(05) let the elements of CS be equal to 0; |
(06) for to 9 do |
(07) //Obtain the checkers-state from pieces-state. |
(08) CS[PS⋅SAS[]⋅][PS⋅SAS[]⋅] = 1; |
(09) CS[PS⋅SPS[]⋅][PS⋅SPS[]⋅] = −1; |
(10) endfor |
(11) maxEva = −Infinity; |
(12) steps - -; |
(13) for to 9 do |
(14) //Evaluate all moves by Depth First Search. |
(15) copyCS = clone(CS); |
(16) FindFallingCheckers(0, copyCS, PS⋅SAS[]⋅, PS⋅SAS[]⋅, allFC, true); |
(17) for each FC in allFC do |
(18) FD = (FC⋅ + FC⋅) − (PS⋅SAS[]⋅ + PS⋅SAS[]⋅); |
(19) Calculate FC_Incre; |
(20) Query CU; |
(21) thisEva = (FD + FC_Incre) * (1 + CU); |
(22) if steps > 0and isFL ==true then |
(23) copyPS = clone(PS); |
(24) Update copyPS with PS⋅SAS[] and FC. |
(25) PiecesStateTransposition(copyPS); |
(26) thisEva = thisEva − TentativeMove(Steps, copyPS, false); |
(27) endif |
(28) if thisEva > maxEva then |
(29) maxEva = thisEva; |
(30) cSC = PS⋅SAS[]; |
(31) cFC = FC; |
(32) endif |
(33) endfor |
(34) endfor |
(35) if isFL == true then |
(36) Update PS with cSC and cFC; |
(37) else if steps > 0then |
(38) copyPS = clone(PS); |
(39) Update copyPS with PS⋅SAS[] and FC; |
(40) PiecesStateTransposition(copyPS); |
(41) maxEva = maxEva −TentativeMove (Steps, copyPS, false); |
(42) endif |
(43) return maxEva; |