Here are 2 HINTS that may help fellow adventurers with the “Robot Ragnarok Challenge!”
To learn if a move is safe, have the next statement of code already in place.
Even if the first move is actually “safe,” your adventurer will stop on that spot if there are no further instructions awaiting them.
As they sit motionless they die, making it seem as if the move they made was the wrong one.
For example :
(this is not from the Challenge, as I do not want to give a “Spoiler,” but rather an example of my HINT).
4 this.moveRight(); (i know already this works)
5 this.moveDown(); (i know already this works)
6 this.moveUp(); (this is the line I am testing to see if it is the next step)
7 this.moveUp(); (this line will just move my adventurer in case step 6 was correct).
If step 6 was incorrect, I will not get to this step 7.
Your this.moveX(); at line 7 can be anything, I used this.moveUp(); because it is the first direction I am going to be “testing” once I find the correct direction for step 6).
Once you get the correct direction for step 6, and you are now testing Step 7, remember to add the this.moveUp(); to Step 8 to keep your adventure on the move.
Test your moves in a progression of Up, Right, Down, Left. It is easy to remember that way!
I hope this helps anyone who is struggling to survive the Robot Ragnarok!
It took me 23 Steps/statements to survive this Challenge.
FUN TIDBIT: "Ragnarok" is from Norse Mythology!
Happy Coding fellow adventurers, I must return to the Kithgard Dungeon to continue my quest to become the Ultimate Coder!