Gem and switch position changes every time I run

For the Land of Bounty lesson from the while loops chapter, the gems and switches positions are changing every time I run It creates confusion, I can write the code to finish the lesson by using other commands, but how do I write the code using only a while loop?

Try to see the introduction to understand the while loop, and use conditions for check the gem or swich on each move for next block so even if the switch ans gems are changing every time, it will collectGem or toggleSwitch only when on that block is gem or switch will be present.