Simple Race KoTH

Rate control

{
    "Rate control": function(distanceTravelled, energyLeft, _, s) {
        if (distanceTravelled === 0) {
            for (let i = 100; i > 0; --i) {
                if (10000 / i > energyLeft) {
                    s.travelSpeed = 100 / (i + 1);
                    break;
                }
            }
        }

        return s.travelSpeed;
    }
}

Each round uses up all of its energy to reach the finish line. Strictly better than "Slow and steady" as this entry will only ever use 1 or more energy per turn while also making sure to always make it to the end. Unoptimized, but still fairly fast.


Slow and steady

{
    "Slow and steady": function() {
        return 1;
    }
}

Baseline bot while I try to figure out what to do with this challenge. Doesn't adapt at all so it might start consistently losing if some sort of meta develops.


Robin Hood

{
    "Robin Hood": function(dist, energy, bots, storage) {
        if (!dist)
            storage.move = [
                [100, 1],
                [200, Math.sqrt(192 / 49) - 0.00695],
                [10000 / 49, (100 / 49)]
            ].sort((a, b) => Math.abs(a[0] - energy) - Math.abs(b[0] - energy))[0][1];

        return storage.move;
    }
}

This bot will do one of three things in a race:

  • Move one unit per turn: This is done in the first race of each game to ensure it has the full 200 energy it needs
  • Move slightly slower than two units per turn: This is done every other turn and saves just enough energy to allow it to...
  • Move slightly faster than two units per turn: This lets it finish one turn faster than the current competitors, and just barely undercuts a few of the previous winners (though Rate control is ahead by a hundredth of a point as of posting)