This is what happens when you're an "adult" and spend too much time on Slack with other nerds. If you're offended, just know that I already took out the really juicy stuff.
while (stillAlive) {
children.forEach(child => {
if (child.age < 18) {
spendTime(child);
}
})
jobsAndChores.forEach(stuffTodo => {
stuffTodo.work();
})
if (grandParentsHouse.contains(children) && random(9999) == 42) {
try {
watchMovie(Movies.Scifi);
}
catch (WifeHomeError e) {
if (wife.complain(e) == true) {
stillAlive = false;
}
else {
watchMovie(Movies.Foreign.Romantic);
}
}
}
}
How would you improve this algorithm?