Method: Rudoku#reduce
- Defined in:
- lib/rudoku.rb
#reduce ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/rudoku.rb', line 91 def reduce success = false @n.times { |r| @n.times { |c| if (sz = @arr[r][c].size) > 1 @arr[r][c] = @arr[r][c] - (@rfix[r] | @cfix[c] | @bfix[rc2box(r, c)]) raise "impossible to solve" if @arr[r][c].empty? if @arr[r][c].size < sz success = true update_fix(r, c) end end } } success end |