1. Shlomi Fish
  2. kakuro-cross-sums

Commits

shl...@b384bcd7-cfd4-0310-aca0-d78b80f7b91b  committed 75f5b39

Extract a method.

  • Participants
  • Parent commits 28531b2
  • Branches default

Comments (0)

Files changed (1)

File solver/ruby/kakuro-board.rb

View file
  • Ignore whitespace
             return flush_dirty
         end
 
+        def filter_constraint_with_mask(dir, mask)
+            return set_new_constraint(dir, constraint(dir).
+                                      select { |c| (c & mask) == c })
+        end
+
         def get_possible_verdicts
             return (0 .. 8).select { |x| (@verdicts_mask & (1 << x)) != 0 }
         end
             def set_new_constraint
                 total_mask = board.calc_total_mask(init_pos, dir)
 
-                return init_cell.set_new_constraint(
-                    dir,
-                    constraint.select { |c| (c & total_mask) == c }
-                )
+                return init_cell.filter_constraint_with_mask(dir, total_mask)
             end
         end