From 55dabbb7c98d9ded2bf94b8e3c81f6baa9806449 Mon Sep 17 00:00:00 2001 From: a14m Date: Mon, 30 Nov 2020 12:05:07 +0100 Subject: Add the x,y position to the cell attributes --- CLI/ruby/lib/game_of_life/generators/input.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'CLI/ruby/lib/game_of_life/generators/input.rb') diff --git a/CLI/ruby/lib/game_of_life/generators/input.rb b/CLI/ruby/lib/game_of_life/generators/input.rb index 7a255fd..cbde075 100644 --- a/CLI/ruby/lib/game_of_life/generators/input.rb +++ b/CLI/ruby/lib/game_of_life/generators/input.rb @@ -34,8 +34,8 @@ module GameOfLife universe = GameOfLife::Universe.new(height: height, width: width) (0...height).each do |i| (0...width).each do |j| - cell = ::GameOfLife::Cell.new(alive: parsed_input.fetch(i, nil)&.fetch(j, nil)) - universe[i][j] = cell + cell = { pos_x: j, pos_y: i, alive: parsed_input.fetch(i, nil)&.fetch(j, nil) } + universe[i][j] = ::GameOfLife::Cell.new(cell) end end universe -- cgit v1.2.3