Changed default number name from big to large, added nums to short commands.

This commit is contained in:
Niels Simenon 2023-04-10 16:50:39 +02:00
parent 6c5fd6ed0a
commit 2860630921
2 changed files with 13 additions and 13 deletions

View File

@ -174,7 +174,7 @@ function onMessage(message, context) {
}
if (game?.state === 'letters') {
const multi = message.body.match(/\b[vc]{2,}\b/i)?.[0];
const multi = message.body.match(/\b[vc]{2,}$/i)?.[0];
if (multi) {
pickLetters(multi.toLowerCase(), context);

View File

@ -181,7 +181,7 @@ async function play(context) {
}
}
function pickBig() {
function pickLarge() {
return pickRandom([100, 75, 50, 25]);
}
@ -196,17 +196,17 @@ function pickNumbers(type, context) {
return;
}
if (type === 'big') {
game.numbers = game.numbers.concat(pickBig());
if (type === 'large') {
game.numbers = game.numbers.concat(pickLarge());
}
if (type === 'small') {
game.numbers = game.numbers.concat(pickSmall());
}
if (type !== 'small' && type !== 'big') {
if (type !== 'small' && type !== 'large') {
type.toLowerCase().slice(0, config.numbers.length - game.numbers.length).split('').forEach((typeKey) => {
game.numbers = game.numbers.concat(typeKey === 'b' || typeKey === 'l' ? pickBig() : pickSmall());
game.numbers = game.numbers.concat(typeKey === 'b' || typeKey === 'l' ? pickLarge() : pickSmall());
});
}
@ -215,7 +215,7 @@ function pickNumbers(type, context) {
return;
}
context.sendMessage(`${getBoard(context)} Would you like a big number or a small one?`, context.room.id);
context.sendMessage(`${getBoard(context)} Would you like a large number or a small one?`, context.room.id);
}
function playSolution(solution, context) {
@ -307,7 +307,7 @@ function start(context, numbers) {
return;
}
context.sendMessage('Let\'s play the numbers! Would you like a big number or a small one?', context.room.id);
context.sendMessage('Let\'s play the numbers! Would you like a large number or a small one?', context.room.id);
}
function solve(calculation, context) {
@ -347,15 +347,15 @@ function onMessage(message, context) {
const body = message.originalBody || message.body; // * gets resolved to <em>
if (game?.state === 'pick') {
const multi = body.match(/\b[bls]{2,}\b/i)?.[0];
const multi = body.match(/\b[bls]{2,}$/i)?.[0];
if (multi) {
pickNumbers(multi.toLowerCase(), context);
return;
}
if (/big/i.test(body)) {
pickNumbers('big', context);
if (/large|big/i.test(body)) {
pickNumbers('large', context);
return;
}
@ -373,6 +373,6 @@ function onMessage(message, context) {
module.exports = {
onCommand,
onMessage,
commands: ['numsgo', 'numgo', 'calculate', 'calc', 'solve'],
help: `Reach the target number using only the ${config.numbers.length} numbers on the board; you do not have to use all of them. You may use addition, subtraction, multiplication and divisions, but each calculation must result in a whole number. You can score points for solutions up to ${config.numbers.points.length} away from the target, but only the first best solution gets the points. Quick-start with ${config.prefix}numsgo, or use ${config.prefix}numbers to fill the board by manually selecting a random *large* or *big* number (100, 75, 50, 25), a random *small* number (1-10), or multiple at once like LLSSSS.`, // eslint-disable-line max-len
commands: ['nums', 'numsgo', 'numgo', 'calculate', 'calc', 'solve'],
help: `Reach the target number using only the ${config.numbers.length} numbers on the board; you do not have to use all of them. You may use addition, subtraction, multiplication and divisions, but each calculation must result in a whole number. You can score points for solutions up to ${config.numbers.points.length - 1} away from the target, but only the first best solution gets the points. Quick-start with ${config.prefix}numsgo, or use ${config.prefix}numbers to fill the board by manually selecting a random *large* or *big* number (100, 75, 50, 25), a random *small* number (1-10), or multiple at once like LLSSSS.`, // eslint-disable-line max-len
};