Skip to content

Instantly share code, notes, and snippets.

@shadowcodex
Last active August 21, 2017 14:32
Show Gist options
  • Save shadowcodex/a382a6a8ffcdb20f0cf54e1e0da1d319 to your computer and use it in GitHub Desktop.
Save shadowcodex/a382a6a8ffcdb20f0cf54e1e0da1d319 to your computer and use it in GitHub Desktop.
Programming a teanager
var body = require('human/body');
var emotions = require('human/emotions');
var teen = spawnHuman({age: 13});
const food = ['pizza', 'chicken nuggets', 'mac and cheese'];
var life = {
'feed': function(item) {
if(food.contains(item)){
life.consume(item);
} else {
life.complain('disgust');
}
},
'consume': function(item) {
for(calories calorie in item) {
body.digest(calorie)
}
},
'complain': function(action) {
switch(action){
case 'disgust': {
life.speak('EW!!!');
break;
}
default: {
life.speak('GO AWAY!!!');
break;
}
}
},
'speak': function(message) {
message = emotions.sass(message);
body.emitSound(message);
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment