Skip to content

Instantly share code, notes, and snippets.

@golbin
Last active August 29, 2015 14:22
Show Gist options
  • Save golbin/933f471ed2b0170d3bcd to your computer and use it in GitHub Desktop.
Save golbin/933f471ed2b0170d3bcd to your computer and use it in GitHub Desktop.
369 Cheat Script
/*
* 3,6,9 치트 스크립트
* 3,6,9 는 박수, 0에서는 키스, 5에서는 만세.
* 액션을 숫자가 나오는 순서에 맞춰야함. 중복도 쳐야함.
* 예) 43 : :clap:
* 39 : :clap: :clap:
* 50 : :raised_hands: :kiss:
*/
var Cheat369 = {
words: {
"3": ":clap:",
"6": ":clap:",
"9": ":clap:",
"5": ":raised_hands:",
"0": ":kiss:"
},
getEmoji: function (char) {
return Cheat369.words[char];
},
isEmoji: function (emoji) {
return emoji !== undefined;
},
tr: function (number) {
var message = number
.toString()
.split('')
.map(Cheat369.getEmoji)
.filter(Cheat369.isEmoji);
return message.length > 0 ?
message.join(' ') :
number;
},
getIndex: function () {
return ++arguments[1];
},
increase: function (num) {
return ++num;
},
getSheets: function (maxRound) {
return Array
.apply(null, Array(maxRound))
.map(Cheat369.getIndex)
.map(Cheat369.increase)
.map(Cheat369.tr);
},
formatMsg: function (msg, index) {
return ["[", ++index, "]", msg].join(' ');
}
};
String.prototype.println = function () {
console.log(this.toString() + "\n");
};
Array.prototype.println = function () {
this.join('\n').println();
};
Cheat369
.getSheets(100)
.map(Cheat369.formatMsg)
.println();
Cheat369
.tr(305)
.println();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment