Getting move cost


Hey all,

Hopefully this is the right category - so I’m trying to calculate the cost of a path, but I need to confirm whether the API I’m using is correct, where from my guess, it’s the halite value of the tile being moved from divided by constants.MOVE_COST_RATIO, anyone able to confirm?

Also while I’m here! … Is there anyway to get the total halite on the map in the API without querying all grid spaces and summing it up? I always notice the replays note the total halite on the map, so I figure it has to be stored somewhere…


That is the way I understand it, and it seems to be correct, based on my bot’s actions.
You can double-check in a replay:
Select ship and observe it’s halite (h_ship) and the halite at the cell (h_cell).
When it moves, the ship’s new halite = h_ship - h_cell/MOVE_COST_RATIO

Note that at some step in there, values are made into integers.

The API Doc appears correct, based on observations

Ships can move one square in a cardinal direction per turn. Each move costs 10% of the halite available in the sea at the ship’s starting location, debited from the ships’ cargo.