Class: Sudoku::SolutionSet::Process::Steps::DeleteRedundantChoices
- Inherits:
-
Sudoku::SolutionSet::Process::Step
- Object
- Sudoku::SolutionSet::Process::Step
- Sudoku::SolutionSet::Process::Steps::DeleteRedundantChoices
- Defined in:
- lib/sudoku/solution_set/process/steps/delete_redundant_choices.rb
Instance Attribute Summary
Attributes inherited from Sudoku::SolutionSet::Process::Step
Instance Method Summary collapse
Methods inherited from Sudoku::SolutionSet::Process::Step
#constraints, #delete_excluded_choices_if, #exclude_choice, #excluded_choices, #include_choice, #included_choices, #initialize, #restore_excluded_choices, #retry?, #revert, #take
Constructor Details
This class inherits a constructor from Sudoku::SolutionSet::Process::Step
Instance Method Details
#revert! ⇒ Object
18 19 20 |
# File 'lib/sudoku/solution_set/process/steps/delete_redundant_choices.rb', line 18 def revert! restore_excluded_choices(output) end |
#take!(choice) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sudoku/solution_set/process/steps/delete_redundant_choices.rb', line 6 def take!(choice) satisfied_constraints = constraints.select { |constraint| constraint.satisfied_by?(choice) } delete_excluded_choices_if do |excluded_choice| satisfied_constraints.any? { |satisfied_constraint| satisfied_constraint.satisfied_by?(excluded_choice) } end end |