Abelian sandpile model/Identity: Difference between revisions
Content deleted Content added
→{{header|Python}}: Added a functionally composed draft. |
→Python :: Functional: Pruned residual magic numbers. |
||
Line 990:
'''The stable final state of a sand-pile.
'''
def p(xs):▼
return all([4 > x for x in xs])▼
xs = list(rows)
w = len(xs)
▲ def p(xs):
return list(chunksOf(w)(
until(p)(
Line 1,007 ⟶ 1,008:
'''
def go(xs):
mbi = findIndex(lambda x:
surplus = 1 + w
if None is mbi:
return xs
Line 1,014 ⟶ 1,016:
return [
1 + k if i in neighbours else (
k -
) for (i, k) in enumerate(xs)
]
|