Added Hunt (hangman) game.

This commit is contained in:
Niels Simenon
2022-10-30 04:21:32 +01:00
parent cb2fa362d6
commit b4add9e11d
9 changed files with 1970 additions and 3 deletions

View File

@@ -3,6 +3,10 @@
const crypto = require('crypto');
function pickRandom(array) {
if (array.length === 0) {
return null;
}
return array[crypto.randomInt(0, array.length)];
}

View File

@@ -37,7 +37,7 @@ function shieldMethods(methods) {
return Object.fromEntries(Object.entries(methods).map(([key, method]) => [key, curate(method)]));
}
module.exports = (() => {
const styleMethods = (() => {
if (config.platform === 'irc') {
return shieldMethods({
...styles,
@@ -66,3 +66,12 @@ module.exports = (() => {
return null;
})();
const expandedMethods = {
...styleMethods,
username: (value) => styleMethods.bold(styleMethods.cyan(value)),
time: (value) => styleMethods.bold(styleMethods.green(value)),
answer: (value) => styleMethods.bold(styleMethods.yellow(value)),
};
module.exports = expandedMethods;