Added letter generator to letters game.

This commit is contained in:
Niels Simenon 2022-10-28 03:44:09 +02:00
parent 809e79affe
commit dc6df7c344
2 changed files with 12 additions and 2 deletions

View File

@ -21,7 +21,7 @@ module.exports = {
greeting: 'Hi, I am aisha, your game host!',
usernamePrefix: '@',
channels: ['GamesNight'],
games: ['mash', 'trivia', 'letters', 'duck', '8ball', 'dice', 'rock-paper-scissors', 'ping', 'say', 'kill', 'uptime', 'help'],
games: ['mash', 'trivia', 'letters', 'duck', '8ball', 'riddle', 'dice', 'rock-paper-scissors', 'ping', 'say', 'kill', 'uptime', 'help'],
schatColors: {
white: 'white',
blue: 'var(--message-40)',

View File

@ -122,7 +122,7 @@ function pickLetters(type, context) {
context.sendMessage(`${getBoard(context)} Would you like a consonant or a vowel?`, context.room.id);
}
function start(context) {
function start(context, letters) {
if (games.has(context.room.id)) {
context.sendMessage(`${getBoard(context)} This is the current board. Use ${config.prefix}letters:stop to reset.`, context.room.id);
return;
@ -136,6 +136,11 @@ function start(context) {
ac: new AbortController(), // eslint-disable-line no-undef
});
if (letters) {
pickLetters(letters.toLowerCase(), context);
return;
}
context.sendMessage('Let\'s play the letters! Would you like a consonant or a vowel?', context.room.id);
}
@ -145,6 +150,11 @@ function onCommand(args, context) {
return;
}
if (['start', 'go', 'auto', 'random'].includes(context.subcommand)) {
start(context, Array.from({ length: config.letters.length }, () => (Math.random() < 0.55 ? 'c' : 'v')).join('')); // a slight bias towards consonants seems to give better boards
return;
}
if (!context.subcommand) {
start(context);
}