Good Day. I'm a beginner in coding, and basically I made a simple maze game using python. 
it's 3x3 so I made 9 dictionary variables that detailed the possible movement for each tile (North, south, east, west.) 
my code consists of nested if-elif as well as a main while loop.

```
if level == 1: #level of difficulty.
    i = 0
    maplist1 = {'directions1':'south'}
    maplist2 = {'directions1':'south','directions2':'east'}
    maplist3 = {'directions1':'west'}
    maplist4 = {'directions1':'north','directions2':'east','directions3':'south'}
....
....
    current_position = 1 #local variable within the first if statement

```

Here's a snippet of the code block that would be repeated, with little to no variations (literally repeating) to it.

```
    while i == 0: #to continuously loop the program
        if current_position == 1:
            directions = maplist1['directions1']
            direction = input(f"What direction do you want to go: {directions} ").title() #choose the possible directions to go to.
            if direction == "S" or direction == "South":
                current_position = 4
                print(f"You are in cell {current_position}.")
            else:
                print("Cannot go in that direction.")
        if current_position == 2:
            directions = maplist2['directions1']
            directions2 = maplist2['directions2']
            direction = input(f"What direction do you want to go: {directions} {directions2} ").title()
            if direction == "S" or direction == "South":
                current_position = 5
                print(f"You are in cell {current_position}.")
            elif direction == "E" or direction == "East":
                current_position = 3
                print(f"You are in cell {current_position}.")
            else:
                print("Cannot go in that direction.")
        if current_position == 3:
            directions = maplist3['directions1']
            direction = input(f"What direction do you want to go: {directions} ").title()
            if direction == "W" or direction == "West":
                current_position = 2
                print(f"You are in cell {current_position}.")
            else:
                print("Cannot go in that direction.")
        if current_position == 4:
            directions = maplist4['directions1']
            directions2 = maplist4['directions2']
            directions3 = maplist4['directions3']
            direction = input(f"What direction do you want to go: {directions} {directions2} {directions3} ").title()
            if direction == "N" or direction == "North":
                current_position = 1
                print(f"You are in cell {current_position}.")
            elif direction == "S" or direction == "South":
                current_position = 7
                print(f"You are in cell {current_position}.")
            elif direction == "E" or direction == "East":
                current_position = 5
                print(f"You are in cell {current_position}.")
            else:
                print("Cannot go in that direction.")
.......
......
.......
        if current_position == 9:
            print("Congratulations, you finished the game.")
            i += 1 #to stop the loop

```

my question is how to make this simpler, and more compact?

* Current location must be remembered every movement
* I know how to use def but quite unsure on how to implement it in my maze game.

There are 3 levels to this game, basically 3x3, 4x4, and 5x5. that's the reason why I am asking for any ideas on how to shorten/compact the code. 

I don't need you to give me your code, but some guidance would be great on how to proceed because i am feeling lost right now.