|
|
|
|
|
|
|
|
print("".join([wall if x == True else path for x in line])) |
|
|
print("".join([wall if x == True else path for x in line])) |
|
|
print() |
|
|
print() |
|
|
|
|
|
|
|
|
def main(x=None, y=None, seed=None, d_lmt=None, a_lmt=None, reps=None, out=None): |
|
|
|
|
|
|
|
|
def main(x=None, y=None, seed=None, d_lmt=None, a_lmt=None, reps=None, out=None, color=None): |
|
|
# Initialize |
|
|
# Initialize |
|
|
x = 20 if x == None else int(x) |
|
|
x = 20 if x == None else int(x) |
|
|
y = 20 if y == None else int(y) |
|
|
y = 20 if y == None else int(y) |
|
|
|
|
|
|
|
|
a_lmt = 4 if a_lmt == None else int(a_lmt) |
|
|
a_lmt = 4 if a_lmt == None else int(a_lmt) |
|
|
reps = 2 if reps == None else int(reps) |
|
|
reps = 2 if reps == None else int(reps) |
|
|
out = False if out == None else bool(out) |
|
|
out = False if out == None else bool(out) |
|
|
|
|
|
color = False if color == None else bool(color) |
|
|
my_map = createDungeon(x,y,seed) |
|
|
my_map = createDungeon(x,y,seed) |
|
|
if not out: |
|
|
if not out: |
|
|
printDungeon(my_map) |
|
|
printDungeon(my_map) |
|
|
|
|
|
|
|
|
if out: |
|
|
if out: |
|
|
img = Image.new("RGB",(x,y),(0,0,0)) |
|
|
img = Image.new("RGB",(x,y),(0,0,0)) |
|
|
lst = [] |
|
|
lst = [] |
|
|
|
|
|
c_wall = [r.randint(0,255), r.randint(0,255), r.randint(0,255)] if color else [0,0,0] |
|
|
|
|
|
c_space = [255-x for x in c_wall] |
|
|
|
|
|
|
|
|
for line in my_map: |
|
|
for line in my_map: |
|
|
for val in line: |
|
|
for val in line: |
|
|
lst.append((0,0,0) if val else (255,255,255)) |
|
|
|
|
|
|
|
|
lst.append(tuple(c_space) if val else tuple(c_wall)) |
|
|
img.putdata(lst) |
|
|
img.putdata(lst) |
|
|
hexes = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"] |
|
|
hexes = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"] |
|
|
filename = [] |
|
|
filename = [] |
|
|
|
|
|
|
|
|
"--death" : 4, |
|
|
"--death" : 4, |
|
|
"--birth" : 4, |
|
|
"--birth" : 4, |
|
|
"--reps" : 2, |
|
|
"--reps" : 2, |
|
|
"--out" : False |
|
|
|
|
|
|
|
|
"--out" : False, |
|
|
|
|
|
"--color" : False, |
|
|
} |
|
|
} |
|
|
for flag, default in flags.items(): |
|
|
for flag, default in flags.items(): |
|
|
if flag in args: |
|
|
if flag in args: |
|
|
if flag == "--out": |
|
|
if flag == "--out": |
|
|
flags["--out"] = True |
|
|
flags["--out"] = True |
|
|
|
|
|
elif flag == "--color": |
|
|
|
|
|
flags["--color"] = True |
|
|
else: |
|
|
else: |
|
|
flags[flag] = args[args.index(flag) + 1] |
|
|
flags[flag] = args[args.index(flag) + 1] |
|
|
return flags |
|
|
return flags |
|
|
|
|
|
|
|
|
flags["--death"], |
|
|
flags["--death"], |
|
|
flags["--birth"], |
|
|
flags["--birth"], |
|
|
flags["--reps"], |
|
|
flags["--reps"], |
|
|
flags["--out"]) |
|
|
|
|
|
|
|
|
flags["--out"], |
|
|
|
|
|
flags["--color"]) |