# What is wrong with the pos thing?

``````# 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())

def theOne():
kerke=[]
for coinR in goldMap:
theOne=None
for coin in coinR:
high=0
if coin.value>high:
theOne=coin
high=coin.value
kerke.push(theOne)
return kerke
while True:
k=theOne()
for i in k:
hero.move(k[i].pos)
``````

It says the position doesn’t exist for some reason.

Also the algorithm is correct, right?

So your goldMap contains coin values not coins themselves. As the result `k[i]` is not a coin and don’t have `pos`