Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Steven Young
Steven Young
2,486 Points

dungeon game (Python collections) question

instead of having a special get_moves method, can I do something like this?

while True:
  moves = get_moves(player)
  print("Welcome to the dungeon!")
  print("You're currently in room {}".format(player))  # fill in with player position
  print("You can move {}".format(moves))
  print("Enter QUIT to quit")

  move = input("> ")
  move = move.upper()

  if move == 'QUIT':

  x,y = player

  if move == LEFT:
    if y == 0:
      y = 0
      y = y - 1
  if move == RIGHT
    if y == 2:
      y = 2
      y = y + 1

#(and the same for up and down)

player = x,y

1 Answer

Looks right to me, did you try it out in the workspace? =D