Created
October 30, 2013 13:28
-
-
Save danmatthews/7232685 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
shuffle = (a) -> | |
# From the end of the list to the beginning, pick element `i`. | |
for i in [a.length-1..1] | |
# Choose random element `j` to the front of `i` to swap with. | |
j = Math.floor Math.random() * (i + 1) | |
# Swap `j` with `i`, using destructured assignment | |
[a[i], a[j]] = [a[j], a[i]] | |
# Return the shuffled array. | |
a[0] | |
module.exports = (robot) -> | |
robot.respond /yo mamma/i, (msg) -> | |
insults = [ | |
"Yo mamma so fat I took a picture of her last Christmas and its still printing...", | |
"Yo mama is so fat, she got arrested at the airport for ten pounds of crack", | |
"Yo mama so fat she wore a yellow raincoat and people yelled 'Taxi'!", | |
"Yo mama so fat she's got more Chins than a Hong Kong phone book.", | |
"Yo mama so fat she put on her lipstick with a paint-roller.", | |
"Yo mama so fat Mount Everest tried to climb her.", | |
"Yo mamma so fat not even Dora can explore her" | |
] | |
msg.send shuffle(insults) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment