Commits

shl...@27f4d2be-69b7-b1af-7dc8-71755b09f50e  committed 22af7bc

Refactoring: convert a yield loop to an Enumerable.

  • Participants
  • Parent commits b424420

Comments (0)

Files changed (1)

File hitori-solver-in-ruby/hitori-solver.rb

 
             include Offset_Module
 
-            attr_reader :whites, :adjacent_blacks
+            attr_reader :whites, :adjacent_blacks, :regions
             def initialize()
                 @whites = {}
                 @adjacent_blacks = {}
             _optimize_regions()
         end
 
-        def each_region
-            @regions.each { |r| yield r }
-        end
-       
     end
 
     class Process
 
             white_regions.calc_regions()
 
-            white_regions.each_region do |r|
+            white_regions.regions.each do |r|
                 unknowns = r.get_adjacent_unknowns()
                 if (unknowns.length == 1)
                     add_yx_move(