From 3368aac24442dfab42c7e15ca42495e65a4ee74f Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 17 Jan 2021 12:55:40 -0500 Subject: [PATCH] force two vowels in anagrams --- commands/games-sp/anagramica.js | 9 ++++++--- package.json | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/commands/games-sp/anagramica.js b/commands/games-sp/anagramica.js index cb7a06b3..651c2e74 100644 --- a/commands/games-sp/anagramica.js +++ b/commands/games-sp/anagramica.js @@ -1,9 +1,10 @@ const Command = require('../../structures/Command'); const { stripIndents } = require('common-tags'); const request = require('node-superfetch'); -const { reactIfAble, fetchHSUserDisplay } = require('../../util/Util'); +const { shuffle, reactIfAble, fetchHSUserDisplay } = require('../../util/Util'); const scores = require('../../assets/json/anagramica'); const pool = 'abcdefghijklmnopqrstuvwxyz'.split(''); +const vowels = ['a', 'e', 'i', 'o', 'u', 'y']; const { SUCCESS_EMOJI_ID, FAILURE_EMOJI_ID } = process.env; module.exports = class AnagramicaCommand extends Command { @@ -100,9 +101,11 @@ module.exports = class AnagramicaCommand extends Command { async fetchList() { const letters = []; - for (let i = 0; i < 10; i++) letters.push(pool[Math.floor(Math.random() * pool.length)]); + letters.push(vowels[Math.floor(Math.random() * vowels.length)]); + letters.push(vowels[Math.floor(Math.random() * vowels.length)]); + for (let i = 0; i < 8; i++) letters.push(pool[Math.floor(Math.random() * pool.length)]); const { body } = await request.get(`http://www.anagramica.com/all/${letters.join('')}`); - return { valid: body.all, letters }; + return { valid: body.all, letters: shuffle(letters) }; } getScore(letters, word) { diff --git a/package.json b/package.json index 22bae330..b0a77540 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "126.5.0", + "version": "126.5.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {