From c4026281618be633169a015b86713b9d9617ce9a Mon Sep 17 00:00:00 2001 From: ThePendulum Date: Wed, 14 Aug 2024 01:37:08 +0200 Subject: [PATCH] Disable wordle bonus points for small dictionaries. --- config/default.js | 1 + src/games/wordle.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/default.js b/config/default.js index 5c63c5c..4526bd5 100755 --- a/config/default.js +++ b/config/default.js @@ -137,6 +137,7 @@ module.exports = { wordle: { minLength: 3, length: 5, + bonusDictionaryThreshold: 1000, // minimum dictionary size to assign bonus points, prevent people from scoring full bonus points from 1-word dictionaries mode: 'easy', }, numbers: { diff --git a/src/games/wordle.js b/src/games/wordle.js index a288c3e..f56472c 100644 --- a/src/games/wordle.js +++ b/src/games/wordle.js @@ -185,11 +185,15 @@ function play(guess, context) { wordle.guesses = wordle.guesses.concat([[context.user.username, upperGuess]]); if (upperGuess === wordle.word) { - const points = Math.max((wordle.word.length + 1) - wordle.guesses.length, 1); + const assignBonusPoints = wordle.wordList.length > config.wordle.bonusDictionaryThreshold; + const points = assignBonusPoints + ? Math.max((wordle.word.length + 1) - wordle.guesses.length, 1) + : 1; + const definition = wordle.definitions[0] ? `: ${style.italic(`${wordle.definitions[0].slice(0, 100)}${wordle.definitions[0].length > 100 ? '...' : ''}`)}` : ''; context.setPoints(context.user, points); - context.sendMessage(`${getBoard(check, false, context)} is correct in ${wordle.guesses.length} guesses! ${style.bold(style.cyan(`${config.usernamePrefix}${context.user.username}`))} gets ${points} ${points > 1 ? 'points' : 'point'}. ${style.bold(wordle.word)}${definition}`, context.room.id); + context.sendMessage(`${getBoard(check, false, context)} is correct in ${wordle.guesses.length} guesses! ${style.bold(style.cyan(`${config.usernamePrefix}${context.user.username}`))} gets ${points} ${points > 1 ? 'points' : 'point'}${assignBonusPoints ? '. ' : ` (${wordle.word.length}-letter dictionary too small for bonus points). `}${style.bold(wordle.word)}${definition}`, context.room.id); wordles.delete(context.room.id);