Commits

Shlomi Fish  committed 4144cc2

Implement the more correct Raymond's Prune.

Based on
http://tech.groups.yahoo.com/group/fc-solve-discuss/message/1260 .

  • Participants
  • Parent commits dd80a81
  • Branches correcting_raymonds_prune

Comments (0)

Files changed (2)

File fc-solve/source/freecell.c

             }
 #endif
 
-            int other_deck_idx;
-            for (other_deck_idx = 0 ; other_deck_idx < (INSTANCE_DECKS_NUM << 2) ; other_deck_idx++)
+            int other_suit_idx;
+            int min_other_color_val = FCS_MAX_RANK+1, min_same_color_val = FCS_MAX_RANK+1;
+            for (other_suit_idx = 0 ; other_suit_idx < (INSTANCE_DECKS_NUM << 2) ; other_suit_idx++)
             {
-                if (fcs_foundation_value(*my_ptr_state, other_deck_idx)
-                        < fcs_card_rank(card) - 2 -
-                        (
-                            SEQS_ARE_BUILT_BY_RANK()
-                            ? 0
-                            : ((other_deck_idx&0x1) == (fcs_card_suit(card)&0x1))
-                        )
-                   )
+                if (( other_suit_idx & (4-1)) != fcs_card_suit(card))
                 {
-                    break;
+                    if (SEQS_ARE_BUILT_BY_RANK())
+                    {
+                        min_other_color_val = min(min_other_color_val, fcs_foundation_value(*my_ptr_state, other_suit_idx));
+                    }
+                    else if (
+                        ((other_suit_idx&0x1) == (fcs_card_suit(card)&0x1))
+                    )
+                    {
+                        min_same_color_val = min(min_same_color_val, fcs_foundation_value(*my_ptr_state, other_suit_idx));
+                    }
+                    else
+                        min_other_color_val = min(min_other_color_val, fcs_foundation_value(*my_ptr_state, other_suit_idx));
+                    {
+                    }
                 }
             }
-            if (other_deck_idx == (INSTANCE_DECKS_NUM << 2))
+            if (
+                (min_other_color_val+1 < fcs_card_rank(card))
+                &&
+                (SEQS_ARE_BUILT_BY_RANK()
+                    ? TRUE
+                    :
+                    (
+                        (min_other_color_val+1 == fcs_card_rank(card))
+                            &&
+                        (fcs_card_rank(card) <= min_same_color_val+(2+1))
+                    )
+                )
+            )
             {
                 return ret_val;
             }

File fc-solve/source/t/t/data/digests-and-lens-storage.yml

     hexdigest: 34bc7c9fe871e50275975323be93c133e73f135db751a985a32f92323f1d6377
     len: 27193
   qualified_seed_for_6240:
-    hexdigest: 745b535c4bb1d28a0a437efda1a31091aaa1f2fbe1dc2fa6cbe19b8f9936c1b1
-    len: 22417
+    hexdigest: 93015fd6bb54e16f69a130ba27a675a1b794551f54c6f1d6750f336314cb0ddc
+    len: 26315
   random_dfs_with_rand_parens:
     hexdigest: ea188af2dbc420480508f0a51e4ffb97ab736cc01a24d9117a578fc0caf6b4f4
     len: 44129