CodeCombat GD2 Level 23 Run for Gold

I have been working on hours on this one and cannot figure it out, can someone assist?

Welcome to the forum @Marc89 ! :partying_face: This is a friendly place where you can ask help on levels, report bugs, or just chat with other coders! Don’t forget to read the guidelines if you haven’t yet. Have a great time!

Would you please post your code and format it using this button: