Class: Cliptic::Main::Windows::Grid

Inherits:
Windows::Grid show all
Defined in:
lib/cliptic/main.rb

Constant Summary

Constants included from Chars

Chars::Block, Chars::HL, Chars::LL, Chars::LS, Chars::LU, Chars::MS, Chars::Nums, Chars::RL, Chars::RS, Chars::RU, Chars::TD, Chars::TL, Chars::TR, Chars::TU, Chars::Tick, Chars::VL, Chars::XX

Instance Attribute Summary collapse

Attributes inherited from Windows::Grid

#cells, #sq

Attributes inherited from Windows::Window

#centered_x, #centered_y, #col, #line, #x, #y

Instance Method Summary collapse

Methods inherited from Windows::Grid

#add_str

Methods inherited from Windows::Window

#add_str, #bold, #clear, #color, #move, #refresh, #reset_attrs, #reset_pos, #setpos, #standend, #standout, #time_str, #wrap_str

Methods included from Chars

small_num

Constructor Details

#initialize(puzzle:) ⇒ Grid

Returns a new instance of Grid.



32
33
34
35
36
# File 'lib/cliptic/main.rb', line 32

def initialize(puzzle:)
  super(**puzzle.size, line:1)
  @indices,@blocks = puzzle.indices,puzzle.blocks
  link_cells_to_clues(clues:puzzle.clues)
end

Instance Attribute Details

#blocksObject (readonly)

Returns the value of attribute blocks.



31
32
33
# File 'lib/cliptic/main.rb', line 31

def blocks
  @blocks
end

#indicesObject (readonly)

Returns the value of attribute indices.



31
32
33
# File 'lib/cliptic/main.rb', line 31

def indices
  @indices
end

Instance Method Details

#cell(y:, x:) ⇒ Object



42
43
44
# File 'lib/cliptic/main.rb', line 42

def cell(y:, x:)
  cells[y][x]
end

#drawObject



37
38
39
40
41
# File 'lib/cliptic/main.rb', line 37

def draw
  super
  add_indices
  add_blocks
end