Heh…I’m already looking at it. @ActualllOLLIEpop, your hero is getting caught in a never ending (rather than endless) loop, where he is cycling between pos1 and pos2…the code never progresses beyond the move(pos2) line.
In my solution, I used a linear method, rather than loops. Not saying we can’t get your version to work, just that it might be a bit more complex than necessary. In my method, I build a trap on the X, move back behind the trees, then on to the treasure. Using the only loop, I pick up all items, then high tail it back to the starting point. This took only 7 lines of code.
If you would like to give this a try, go for it! Otherwise, we can work on your code as it is.
hi @dedreous. i’ve tried the linear method, and my hero starts by going to the place where he need to be and builds a trap, but then he goes straight to the coins here’s my code:
It does…it blows, just about the time I’m rounding the bottom trees, providing a distraction just long enough for me to reach the coins. The yetti does attack me, but I’m able to finish collecting all of the coins and the run back to the start…he does chase me, but it’s already too late by then, the game is over.
Hi, we don’t really give you the solution here but rather try to help :) so would you like to post your code and someone can have a look at it? (also, (@)dedreous hasn’t been on for a long time so replying to his posts is useless)
(also, side note, I know a website with every solution on codecombat, so if code is copied from somewhere I will know, and if I don’t, someone else will)