Open zaebee opened 3 months ago
@MioxLovePython could you please assign this task to you?
Simple example
"""Maze generator.
"""
import random
WIDTH = 10
HEIGHT = 10
def generate():
start_map = ['|', '_'] #, '0']
map = []
for _ in range(HEIGHT):
row = [random.choice(start_map) for _ in range(WIDTH)]
map.append(row)
return map
# '\n'.join(' '.join(row) for row in map)
map = generate()
indexes = [
[0, random.randint(0, 9)],
[9, random.randint(0, 9)],
[random.randint(0, 9), 0],
[random.randint(0, 9), 9]
]
enter_index = random.choice(indexes)
row, col = enter_index
map[row][col] = '0'
print('\n'.join(' '.join(row) for row in map))
Create list of list with walls (without enter/exit]. Like this: