I have this task where I must print a maze that also provides the user's position. However this position can be dependent on the generated position from another function. What I mean is that the position can have many different possibilites.
I tried to use slicing with a combination of the .replace method to be able to change the character to the user's position symbolled as 'A'.
See the code below, am I doing something wrong here?
def print_maze(maze, position):
"""
Returns maze string from text file and position of the player
print_maze(str, int) -> object
"""
p1 = position[0]
p2 = position[1]
position = position_to_index((p1,p2), len(maze))
for line in maze:
maze = maze[:position].replace(' ', 'A') + maze[position:]
for line in maze:
maze.strip().split('\n')
print(maze)
For my result so far, all I get is:
>>> maze = load_maze('maze1.txt')
>>> print_maze(maze, (1,1))
#####
#AAZ#
#A###
#AAP#
#####