From 6367f27bf856c30b215ed6a6b8db10088785bf7d Mon Sep 17 00:00:00 2001 From: megamichi Date: Mon, 26 Feb 2024 19:59:34 +0100 Subject: [PATCH] amm --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index d250a8c..4a4c812 100644 --- a/main.py +++ b/main.py @@ -47,18 +47,20 @@ def verarbeite_feld(feld): bellow = feld[(y + 1) % feldy][x] bellowr = feld2[(y + 1) % feldy][(x + 1) % feldx] bellowl = feld2[(y + 1) % feldy][(x - 1) % feldx] + #r = feld2[(y ) % feldy][(x + 1) % feldx] + #l = feld2[(y ) % feldy][(x - 1) % feldx] direction = random.choice([-1, 1]) # Zufällige Auswahl der Richtung if bellow == " " and not bellow == "#": # checke unten feld2[y][x] = feld[(y + 1) % feldy][x] feld2[(y + 1) % feldy][x] = feld[y][x] - elif bellowr == " " and not bellowr == "#" and direction == 1: # checke unten rechts fals richtung nach rechts + elif bellowr == " " and not bellowr == "#" and not r == "#" and direction == 1: # checke unten rechts fals richtung nach rechts feld2[y][x] = feld[(y + 1) % feldy][(x + direction) % feldx] # tausche in kopie aktuelle position mit "a" - feld2[(y + 1) % feldy][(x + direction) % feldx] = feld[y][x] # tausche in kopie neue position mit bevorigen element + feld2[(y + 1) % feldy][(x + 1) % feldx] = feld[y][x] # tausche in kopie neue position mit bevorigen element - elif bellowl == " " and not bellowl == "#" and direction == -1: # checke unten links fals richtung nach links + elif bellowl == " " and not bellowl == "#" and not l == "#" and direction == -1: # checke unten links fals richtung nach links feld2[y][x] = feld[(y + 1) % feldy][(x + direction) % feldx] - feld2[(y + 1) % feldy][(x + direction) % feldx] = feld[y][x] + feld2[(y + 1) % feldy][(x + -1) % feldx] = feld[y][x] return feld2 # gib kopie zurück