Python Python Collections (2016, retired 2019) Dungeon Game Movement

David P
PRO
David P
Pro Student 1,162 Points

My code is not working because it keeps saying player is not define. Did anyone else have this problem with the game?

Does Kenneth ever define player in his code and if so please share with me where. My dungeon game will not work with code valid_moves = get_moves(player) since player is not defined.

2 Answers

Mischa Yartsev
Mischa Yartsev
20,490 Points

Hey, guys!

David P, I think I know the answer on your question without seeing your code.

player variable was defined right above the while True loop, together with the monster and door variables:

monster, player, door = get_locations()

So, the function get_locations() was kinda unpacked unique locations for each variables respectively.

Hope, it helps!

FHATUWANI Dondry MUVHANGO
FHATUWANI Dondry MUVHANGO
17,796 Points

It will be better if you post your code, so that we can have an idea of were exactly the problem is

Chris Freeman
Chris Freeman
Treehouse Moderator 58,878 Points

FHATUWANI Dondry MUVHANGO, Thanks for helping out in the forum. If I may make a suggestion, it is better for this type of post to be a comment under the original post rather than a post answer. Posting as an answer makes the original post look like it has actually been answered from the summary page and lowers traffic to the page. Keep up the good work!

FHATUWANI Dondry MUVHANGO
FHATUWANI Dondry MUVHANGO
17,796 Points

ok got it.

it does make sense thanks. Chris Freeman