PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from random import shuffle
from copy import deepcopy
import os
def main():
parameters = dungeon_info()
dungeon = gen_dungeon(parameters)
show_dungeon(dungeon)
res = has_escape_route(dungeon)
print(True, len(res)) if res else print(False)
def dungeon_info():
while True:
try:
level = int(input('How many level the dungeon has?\n> '))
width = int(input('How wide is the dungeon?\n> '))
treasure = int(input('How many treasure in the dungeon?\n> '))
except:
print('Invalid input. Input must be integer.')
refresh()
continue
parameters = (level, width, treasure)
if min(parameters) <= 0:
print('\nInput must greater then zero.')
refresh()
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run