Browse Source

Correcting the smoothing algorithm

master
Noëlle Anthony 7 years ago
parent
commit
f23d273c48
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      procgen.py

+ 3
- 3
procgen.py View File

@@ -22,7 +22,7 @@ def createDungeon(x=None, y=None, seed=None):
def refineDungeon(d_map, d_lmt=None, a_lmt=None):
""" Refines the grid.
"""
d_lmt = 3 if d_lmt == None else int(d_lmt)
d_lmt = 4 if d_lmt == None else int(d_lmt)
a_lmt = 4 if a_lmt == None else int(a_lmt)
new_map = []
for j in range(len(d_map)):
@@ -31,12 +31,12 @@ def refineDungeon(d_map, d_lmt=None, a_lmt=None):
x, y = i, j
n_count = countAliveNeighbors(d_map, x, y)
if d_map[y][x]:
if n_count <= d_lmt:
if n_count >= a_lmt:
new_line.append(False)
else:
new_line.append(True)
else:
if n_count >= a_lmt:
if n_count <= d_lmt:
new_line.append(True)
else:
new_line.append(False)

Loading…
Cancel
Save