Class: Space

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSpace



194
195
196
197
198
199
# File 'lib/minesweeper.rb', line 194

def initialize
  @visible = false
  @flagged = false
  @mine = false
  @nearby_mines = nil
end

Instance Attribute Details

#flaggedObject

Returns the value of attribute flagged.



192
193
194
# File 'lib/minesweeper.rb', line 192

def flagged
  @flagged
end

#mineObject

Returns the value of attribute mine.



192
193
194
# File 'lib/minesweeper.rb', line 192

def mine
  @mine
end

#nearby_minesObject

Returns the value of attribute nearby_mines.



192
193
194
# File 'lib/minesweeper.rb', line 192

def nearby_mines
  @nearby_mines
end

#visibleObject

Returns the value of attribute visible.



192
193
194
# File 'lib/minesweeper.rb', line 192

def visible
  @visible
end

Instance Method Details

#clear?Boolean



201
202
203
# File 'lib/minesweeper.rb', line 201

def clear?
  visible && !mine
end

#zero_nearby?Boolean



205
206
207
# File 'lib/minesweeper.rb', line 205

def zero_nearby?
  clear? && self.nearby_mines == 0
end