class Cell attr_reader :row, :column attr_accessor :value attr_accessor :n, :ne, :e, :se, :s, :sw, :w, :nw def initialize(row, column) @row, @column = row, column end def neighbours list = [] list << n if n list << ne if ne list << e if e list << se if se list << s if s list << sw if sw list << w if w list << nw if nw list end end