It's not you just don't understand it, the default detection range is 5, with your code if there is any ore within 5 of the miner it will mine without going forward. It's really good if you progress a bit