From fe10689d7a8b7c2019084e484f25891aefd745b8 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Sun, 25 Feb 2024 21:52:57 +0100 Subject: [PATCH] Removed debug print and made some performance upgrades. --- falling_sand.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/falling_sand.py b/falling_sand.py index 906e759..1af02eb 100644 --- a/falling_sand.py +++ b/falling_sand.py @@ -174,14 +174,13 @@ class FallingSand: def spawn_sand(self, position): x, y = position - for ax in range(-4, 5): - for ay in range(-4, 5): - print(ax, ay) + for ax in range(-8, 9): + for ay in range(-8, 9): bx, by = position bx += ax by += ay - if self.matrix[bx, by] == self.sand_surface.map_rgb(self.gray): + if self.matrix[bx, by] == self.sand_surface.map_rgb(self.gray) and bx % 2 == 0 and by % 2 == 0: self.falling_sand_particles.append(FallingSandParticle(self, (bx, by)))