How should I punch myself in the face?

Is it better to punch when you're still reasonably awake, or wait until you're about to drop off to sleep? Or is there some other way to optimize the time I can stay awake for by punching myself in the face?

Or does it not matter at all?


The relevant code for health growth & energy drain is here:

if ( health > 0 ) {
    game_time += delta / 1000;

    energy -= delta * energy_speed * Math.random() + ( Math.log( game_time ) * Math.LN2 / 100 );
    if ( energy < 0 ) energy = 0;

    health += delta * health_speed * Math.random();
    if ( health > 100 ) health = 100;
}

Since both energy_speed and health_speed are constant, you can see that health grows at a linear rate. The code for a punch event is here:

energy = Math.min( 100, energy + punch_energy );
health -= punch_damage + punch_damage_random * Math.random();

Again, punch_damage, punch_energy and punch_damage_random are all constant.

Putting these two facts together, if your health is below 100, and your energy is above 0, then it makes no difference when you punch yourself in the face.

The question then becomes when is the optimal time for the first punch? Ideally you want to time your first punch to bring your energy back to exactly 100, and since punch_energy = 20 you want to time your punch to be when your energy hits 80.

diagram for illustration