Skip to content

Issues with small sizes. #2

@Rubiel1

Description

@Rubiel1

Hello,
I want to run (stabilize) small sandpiles but the program sends errors. Below is an example:

npile = Sandpile([[4, 4, 6, 4, 4],       [4, 0, 6, 0, 4],       [6, 6, 0, 6, 6],       [4, 0, 6, 0, 4],       [4, 4, 6, 4, 4]])
>>> npile.grid
array([[4, 4, 6, 4, 4],
       [4, 0, 6, 0, 4],
       [6, 6, 0, 6, 6],
       [4, 0, 6, 0, 4],
       [4, 4, 6, 4, 4]])
>>> npile.run()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sandpile/sandpile/sandpile.py", line 54, in run
    topple(elem_x, elem_y)
  File "sandpile/sandpile/sandpile.py", line 35, in topple
    self.grid[elem_x+1, elem_y] += b
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^
IndexError: index 5 is out of bounds for axis 0 with size 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions