diff --git a/src/simulation/update.ts b/src/simulation/update.ts index c5ec2e3..5f5774d 100644 --- a/src/simulation/update.ts +++ b/src/simulation/update.ts @@ -69,7 +69,7 @@ export function update( } if ( - hasMoved(target.get(x, y + 1)) || hasMoved(target.get(x, y + 2)) + hasMoved(target.get(x, y + 1)) // || hasMoved(target.get(x, y + 2)) ) { const left = isEmpty(target.get(x - 1, y + 1)); const right = isEmpty(target.get(x + 1, y + 1)); @@ -90,10 +90,10 @@ export function update( if (isSand(target.get(x, y - 1))) { swap(target, x, y, x, y - 1); swapped.push([x, y - 1]); - } else if (isSand(target.get(x - 1, y - 1))) { + } else if (isSand(target.get(x - 1, y - 1)) && !hasMoved(target.get(x - 1, y - 1))) { swap(target, x, y, x - 1, y - 1); swapped.push([x - 1, y - 1]); - } else if (isSand(target.get(x + 1, y - 1))) { + } else if (isSand(target.get(x + 1, y - 1)) && !hasMoved(target.get(x + 1, y - 1))) { swap(target, x, y, x + 1, y - 1); swapped.push([x + 1, y - 1]); }