I am trying to learn how to code, using Swift.
Attached is a screenshot from the Swift playgrounds app on iPad, which demonstrates my problem.
Based on my code, why is my guy not picking up the Gem in the last square? Every time he moves, he’s supposed to check to see if there’s a gem, and then if so collectGem(), right?
This puzzle is further complicated by the fact that the only Gem on the map is in the very last square, so I have no idea if the code even works properly anywhere else.
If this is the wrong place to post this, please let me know and I will close or delete it.
Attached is a screenshot from the Swift playgrounds app on iPad, which demonstrates my problem.
Based on my code, why is my guy not picking up the Gem in the last square? Every time he moves, he’s supposed to check to see if there’s a gem, and then if so collectGem(), right?
This puzzle is further complicated by the fact that the only Gem on the map is in the very last square, so I have no idea if the code even works properly anywhere else.
If this is the wrong place to post this, please let me know and I will close or delete it.