amm
This commit is contained in:
parent
b354553a78
commit
6367f27bf8
1 changed files with 6 additions and 4 deletions
10
main.py
10
main.py
|
@ -47,18 +47,20 @@ def verarbeite_feld(feld):
|
||||||
bellow = feld[(y + 1) % feldy][x]
|
bellow = feld[(y + 1) % feldy][x]
|
||||||
bellowr = feld2[(y + 1) % feldy][(x + 1) % feldx]
|
bellowr = feld2[(y + 1) % feldy][(x + 1) % feldx]
|
||||||
bellowl = 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
|
direction = random.choice([-1, 1]) # Zufällige Auswahl der Richtung
|
||||||
if bellow == " " and not bellow == "#": # checke unten
|
if bellow == " " and not bellow == "#": # checke unten
|
||||||
feld2[y][x] = feld[(y + 1) % feldy][x]
|
feld2[y][x] = feld[(y + 1) % feldy][x]
|
||||||
feld2[(y + 1) % feldy][x] = feld[y][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][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][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
|
return feld2 # gib kopie zurück
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue