aoc2025/day_04/cell.rb
2025-12-04 09:48:36 +00:00

23 lines
393 B
Ruby

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