Class: Mazinator::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/mazinator/cell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row, col) ⇒ Cell

Returns a new instance of Cell.



8
9
10
11
12
13
# File 'lib/mazinator/cell.rb', line 8

def initialize(row, col)
  @row = row
  @col = col
  @walls = {left: true, right: true, up: true, down: true}
  @visited = false
end

Instance Attribute Details

#colObject (readonly)

Returns the value of attribute col.



6
7
8
# File 'lib/mazinator/cell.rb', line 6

def col
  @col
end

#rowObject (readonly)

Returns the value of attribute row.



6
7
8
# File 'lib/mazinator/cell.rb', line 6

def row
  @row
end

#visitedObject

Returns the value of attribute visited.



5
6
7
# File 'lib/mazinator/cell.rb', line 5

def visited
  @visited
end

#wallsObject

Returns the value of attribute walls.



5
6
7
# File 'lib/mazinator/cell.rb', line 5

def walls
  @walls
end

Instance Method Details

#visited?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/mazinator/cell.rb', line 15

def visited?
  self.visited
end