Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Level: Diamond Dozen

Problem with findOptimalCoins function. It seems like division its not working, i thing hero is going always for the most value coin, ignoring distance.

@Kuan-Thum you might try changing out the inner while loop for a “if” statement. Also check the glasses you are wearing to ensure you can see far enough.

You could also use console.log(datacoin + " " + coin.value + " " + distance); to output each value looked at to the browser console.