JSFiddle - React, Tailwind, and code Playground

JavaScript

const base_population = 100000;
const BASE_PERCENT = 0.015;
let DR = 1;
let attacks = 0;
const GS_MIN = 10;

const disable_function = false;

const kill_pop = (pop) => {
	if (pop <= 0) return;
  let killed_pop = Math.floor(Math.max(some_function() * pop * BASE_PERCENT, GS_MIN));
  pop -= killed_pop;
  attacks += 1;
  console.log(`DR: ${DR} Attacks: ${attacks} Killed Pop: ${killed_pop} Pop: ${pop}`);
  return kill_pop(pop);
};

const some_function = () => {
	if (disable_function) return 1;
	DR = Math.sin(DR.toFixed(1));
  return DR;
}

kill_pop(base_population);