Class: Rudoku::Block
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
Attributes inherited from Area
Instance Method Summary collapse
-
#initialize(b, n) ⇒ Block
constructor
A new instance of Block.
- #initialize_area ⇒ Object
Methods inherited from Area
#add, #available_nrs, #info, #missing_fields, #remove
Constructor Details
#initialize(b, n) ⇒ Block
Returns a new instance of Block.
331 332 333 334 335 336 |
# File 'lib/rudoku.rb', line 331 def initialize(b, n) @n = n @x = n % 3 @y = n / 3 super end |
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
329 330 331 |
# File 'lib/rudoku.rb', line 329 def fields @fields end |
Instance Method Details
#initialize_area ⇒ Object
338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/rudoku.rb', line 338 def initialize_area f_x = @x * 3 f_y = @y * 3 @fields = [] f_y.upto(f_y + 2) do |y| f_x.upto(f_x + 2) do |x| @fields << board.get(x, y) end end end |