-2

I am trying to run conway's game of life using the function

animate_life(100, 'beacon',[0], 30, 300)

But it keeps popping up errors , in its current form it says :

x_start, y_start = seed_position[0], seed_position[1]

IndexError: list index out of range.

Originally I had used an index that looked like [0,1] but this also reported an error, namely :

IndexError: too many indices for array

I'm given to believe that giving it 2 values would report an issue because you're expecting data to be a 2D array. Numpy is complaining because the data is not 2D (it's either 1D or None)?

My question is: what is the size of the data ?

I.e What size argument is expected in my animate_life function which is generally defined as:

animate_life(universe_size, seed, seed_position, n_generations=30, interval=300, save=False)

Edi: this is referring to the code found at https://github.com/robertmartin8/PyGameofLife/blob/master/game_of_life.py

bhapi
  • 97
  • 3

1 Answers1

2

Clarification: I am basing my answer on the code found here. https://github.com/robertmartin8/PyGameofLife/blob/master/game_of_life.py

I am completely and honestly sure that the index should be a 2-tuple rather than a list, so you should try seed_position=(0,1). Same for universe size; try (100,100).

corwin.amber
  • 393
  • 1
  • 3
  • 10