Golden choice Help

So My character moves but not to the right one. Im unsure how to compare the value of an item to the size. but this is the code i have so far:

// 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.
var distanceX = 4;
var distanceY = 6;
var zeroPoint = {
    x: 14,
    y: 14
};
var coinLines = 10;
function makeGoldMap(coins) {
    var template = [];
    for (var i = 0; i < coinLines; i++) {
        template[i] = [];
        for (var j = 0; j < 2 * coinLines - 1; j++) {
            template[i][j] = 0;
        }
    }
    for (var c = 0; c < coins.length; c++) {
        var row = Math.floor((coins[c].pos.y - zeroPoint.y) / distanceY);
        var col = Math.floor((coins[c].pos.x - zeroPoint.x) / distanceX);
        template[row][col] = coins[c].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]]
var goldMap = makeGoldMap(hero.findItems());
var coins = hero.findItems();
// Find your path.
for (var i = 0; i < goldMap.length; i++) {
    var x = coins[i];
    for (var j = 0; j < goldMap[i].length; j++) {
        var coin = hero.findNearestItem();
        var value = 999;
        var biggest = null;
        if (coin.value < value) {
            value = coin.value;
            biggest = coin;
            if (biggest) {
                hero.move(biggest.pos);
            }
        }
    }
}

I don’t need the solution but I would like some help on how to compare the size of an Item to it’s value

A large coin’s value is 7, a small coin’s value is 2.

it’s a bit confusing that the UI says each coin’s value is 3, but when actually iterate over them and spit out it’s value property they got coin.value from 1 to 9… Also, in codecombat we’ve gotten used to coins having values from 1-3 based on bronze, silver and gold with gems having higher values. For consistency it would have been better to stick with it.