## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

# can someone explain this problem, I have been trying to picture this problem in my mind but I can not.

if you can answer step by step will be more than awesome. Thank you

movement.py
```# EXAMPLES:
# move((1, 1, 10), (-1, 0)) => (0, 1, 10)
# move((0, 1, 10), (-1, 0)) => (0, 1, 5)
# move((0, 9, 5), (0, 1)) => (0, 9, 0)

def move(player, direction):
x, y, hp = player
xx,yy =direction
if 9 > x > 0 == -1
x = x-1
if 0 >= x > 9
return x, y, hp
```

PLUS

I don't like to give away the answer, but to break it down:

```def move(player, direction):
# unpack the player and move
x, y, hp = player
mx, my = direction

# apply the move to the player
x = x + mx
y = y + my

# test if the player has gone outside the bounds, all four sides
# if so, set them at the bound and reduce the hit points
if x > 9:
x = 9
hp = hp - 5

if y > 9:
y = 9
hp = hp - 5

if x < 0:
x = 0
hp = hp - 5

if y < 0:
y = 0
hp = hp - 5

# Return the player
return x, y, hp
```

Thank you, it helps me a lot. I can see now the logic behind and the correlation between the place of the player and the movement.