Skip to content

Instantly share code, notes, and snippets.

@kevincoleman
Last active August 29, 2015 14:12
Show Gist options
  • Save kevincoleman/9593f5d083fc73a54719 to your computer and use it in GitHub Desktop.
Save kevincoleman/9593f5d083fc73a54719 to your computer and use it in GitHub Desktop.
A script to explain the interaction that takes place when a cat jumps on a lap.
var cat = {
annoyance: 30 // cats are never not annoyed
};
var lapContents = [];
var needToPee = 0;
var catSettle = function(settlingCat) {
if (cat.annoyance < 100) {
lapcontents.push(settlingCat);
} else {
console.log('The cat leaves you to your misery.');
}
};
var theInevitable = function() {
needToPee++;
};
var useRestroom = function() {
lapContents = [];
cat.annoyance++;
};
while (lapcontents.length < 1 && cat.annoyance < 100) {
catSettle(cat);
while (lapContents.length !== 0) {
theInevitable();
if (needToPee >= 100) {
useRestroom();
}
}
}
@gringogidget
Copy link

This is adorable 😊

@kevincoleman
Copy link
Author

@gringogidget It’s a truth of life. Had to be scripted somewhere!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment