If you point at your post with your mouse a “bar” of icon will fade in below it (the post), use the pencil icon to edit your post and add the `s J_F_B_M metioned.
In the mean time, I am assuming that your indention is correct and even if it isn’t what I am saying holds.
you are using “coinIndex” OUTSIDE the while loop, and not in it… this means that you only ever look at “one” coin… so your hero (unless there are other errors) does one of two things:
- if coins is gold - walks over to the first coin (coins) and then appears to do nothing (when in fact they are continually walking to the position of the same coin over and over and over . . . being that they are already there, they effectively stand still.
- if coins is not gold - does nothing as that is what they are supposed to do when looking at a non-gold coin…