I’m not even sure where I should start on Golden Choice. Every other discussion I’ve seen has not helped the original author. Sometimes they’ll post that they figured it out, but not how. Not even the Github is helpful, as some of it’s base code is changed from the original’s. Where do I begin? I know I have to find the optimal start, and then find the best of the two diagonal options from the first. I’m not sure how to execute that in code form though. Any help would be much appreciated!

Here’s the starting code. (I haven’t written any myself, as I don’t know where to start)

```
# You must collect the required amount of gold.
# The gate keeper will tell you how much you need.
# Always move in the direction of the exit.
# For each row you can take only one coin.
# Choose only one from the nearest coins in the next row.
# Distance between rows and coins.
distanceX = 4
distanceY = 6
zeroPoint = {"x": 14, "y": 14}
coinLines = 10
def makeGoldMap(coins):
template = [[0 for j in range(2 * coinLines - 1)] for i in range(coinLines)]
for coin in coins:
row = int((coin.pos.y - zeroPoint.y) / distanceY)
col = int((coin.pos.x - zeroPoint.x) / distanceX)
template[row][col] = coin.value
return template
# Prepare the gold map. It looks like:
# [[1, 0, 9, 0, 4],
# [0, 1, 0, 9, 0],
# [8, 0, 2, 0, 9]]
goldMap = makeGoldMap(hero.findItems())
# Find your path.
```

Are you familiar with JavaScript? If yes, I can give you some better starting code, if not… I guess I’ll try and convert it to Python

Can you send the link to the level? I can try to help.

Glacier: CodeCombat - Coding games to learn Python and JavaScript

(Also, to find a level, just do `"https://codecombat.com/play/level/" + level.replace(' ', '-')`

[in your brain of course])

Sorry for a yet again late response, my class does not cover javascript.

I’ve brute forced it, but I know this isn’t the right solution. I already discovered a brute force method on the last level, and I can’t find the right solution to any of them on my own.

Here’s my code:

```
# You must collect the required amount of gold.
# The gate keeper will tell you how much you need.
# Always move in the direction of the exit.
# For each row you can take only one coin.
# Choose only one from the nearest coins in the next row.
# Distance between rows and coins.
distanceX = 4
distanceY = 6
zeroPoint = {"x": 14, "y": 14}
coinLines = 10
def makeGoldMap(coins):
template = [[0 for j in range(2 * coinLines - 1)] for i in range(coinLines)]
for coin in coins:
row = int((coin.pos.y - zeroPoint.y) / distanceY)
col = int((coin.pos.x - zeroPoint.x) / distanceX)
template[row][col] = coin.value
return template
# Prepare the gold map. It looks like:
# [[1, 0, 9, 0, 4],
# [0, 1, 0, 9, 0],
# [8, 0, 2, 0, 9]]
goldMap = makeGoldMap(hero.findItems())
# Find your path.
items = hero.findItems()
def findStartCoin(items):
bestValueStart = 0
bestItemStart = None
for item in items:
if item.value > bestValueStart:
bestValueStart = item.value
bestItemStart = item
return bestItemStart
bestFirst = findStartCoin(items)
if bestFirst:
hero.moveXY(bestFirst.pos.x, bestFirst.pos.y)
def findNextCoin(items):
bestValueNext = 0
bestItemNext = None
for item in items:
distance = hero.distanceTo(item)
if distance < 10 and item.pos.y > hero.pos.y + 2:
if item.value > bestValueNext:
bestValueNext = item.value
bestItemNext = item
return bestItemNext
while True:
items = hero.findItems()
bestNext = findNextCoin(items)
if bestNext:
hero.moveXY(bestNext.pos.x, bestNext.pos.y)
```

I feel like some of these levels are getting rather ridiculous, especially with the easy way out being child’s play in comparison to the real solution.

Technically yes, but I do wish I knew the true solution.

I can PM you my solution if you want

Sounds good to me.

(20 Chars)