Back to General discussions forum
Hi all,
I've tried to compute a number of times this problem and I think there is an error. If you have a grid:
----XXX -XXXX-- -XX-XX- ------X ---X-X-
The solution the problem shows is 12 18 12 16 15, however this is wrong (it should return 11 14 10 9 13). Does anybody know how this is possible?
Does your code give the correct answer for the example input?
12 18 12 16 15 is the correct answer. If you can't find your error, please show us what you think the grid is after 1 turn.
Hi,
My code does output the correct answer for the example.
for this grid:
[- - - - X X X] [- X X X X - -] [- X X - X X -] [- - - - - - X] [- - - X - X -]
The first iteration would be: [- - X - X X -] [- X - - - - X] [- X - - X X -] [- - X X - - X] [- - - - - - -]
I've tried doing it by hand, and unless I made a mistake, there should be 11 life forms.
The initial configuration is a 5 by 7 fragment of the game field.
For the first move, if you put the initial configuration in the middle of a 7 by 9 grid, you'll get 12 life forms.
So do I need to use a 7 by 9 grid instead of the 5 by 7?
Note: if you will implement the game using a kind of 2D array, make sure it is large enough and the initial configuration is placed far from edges, so that it will not reach them in 5 moves - otherwise your results could be spoiled.