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! While you're at it, check out some resources Treehouse students have shared here.
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 trialDavid P
Courses Plus Student 1,162 PointsMy 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
20,562 PointsHey, 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
17,796 PointsIt will be better if you post your code, so that we can have an idea of were exactly the problem is
Chris Freeman
Treehouse Moderator 68,457 PointsFHATUWANI 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
17,796 Pointsok got it.
it does make sense thanks. Chris Freeman
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsCan you post your code?