function reallocate(memText) {
const memory = memText.split("\t").map(Number);
const i = d3.maxIndex(memory);
const distrib = Math.floor(memory[i] / 16);
const remainder = memory[i] % 16;
memory[i] = 0;
for (let j = 0; j < 16; j++) {
memory[j] += distrib;
}
for (let j = 1; j <= remainder; j++) {
memory[(i + j) % 16]++;
}
return memory.join("\t");
}