Last active
August 29, 2015 14:12
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@gringogidget It’s a truth of life. Had to be scripted somewhere!