mirror of
https://github.com/onyx-and-iris/aoc2025.git
synced 2025-12-08 11:47:47 +00:00
23 lines
393 B
Ruby
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
|