Forráskód Böngészése

fix: vowel-first solver picks starting word from the actual word bank

Removed hardcoded English starting words (adieu, audio, raise,
arose, irate) that caused the Russian solver to use non-Russian
guesses. Now dynamically picks the best vowel-rich word from the
actual guessable list for any language.
Oleg Panashchenko 1 hete
szülő
commit
18b945bfed
3 módosított fájl, 1376 hozzáadás és 242 törlés
  1. 695 117
      data/word-bank-ru.json
  2. 668 115
      data/word-bank.json
  3. 13 10
      solver/src/vowel-first.ts

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 695 - 117
data/word-bank-ru.json


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 668 - 115
data/word-bank.json


+ 13 - 10
solver/src/vowel-first.ts

@@ -1,7 +1,6 @@
 import type { SolverStep } from '@wordle/shared';
 
 const VOWELS = new Set(['a','e','i','o','u']);
-const VOWEL_STARTS = ['adieu','audio','raise','arose','irate'];
 
 function getFeedback(target: string, guess: string): string {
   const tu = target.toLowerCase(), gu = guess.toLowerCase();
@@ -15,6 +14,17 @@ function getFeedback(target: string, guess: string): string {
 
 function matchesFeedback(c: string, g: string, fb: string): boolean { return getFeedback(c, g) === fb; }
 
+function pickBestVowelWord(pool: string[], knownVowels: Set<string>): string {
+  let bestGuess = pool[0];
+  let best = -1;
+  for (const w of pool) {
+    const newV = [...w].filter((c) => VOWELS.has(c) && !knownVowels.has(c)).length;
+    const s = newV * 3 + new Set(w.split('')).size;
+    if (s > best) { best = s; bestGuess = w; }
+  }
+  return bestGuess;
+}
+
 export function solveVowelFirst(target: string, allWords: string[], maxAttempts = 6): { attempts: number; steps: SolverStep[] } {
   let candidates = [...allWords];
   const knownVowels = new Set<string>();
@@ -22,16 +32,9 @@ export function solveVowelFirst(target: string, allWords: string[], maxAttempts
 
   for (let attempt = 1; attempt <= maxAttempts; attempt++) {
     let bestGuess: string;
-    if (attempt === 1) {
-      bestGuess = VOWEL_STARTS.find((w) => allWords.includes(w)) ?? 'arise';
-    } else if (attempt <= 3 && knownVowels.size < 5) {
+    if (attempt <= 3 && knownVowels.size < 5) {
       const pool = candidates.length > 0 ? candidates : allWords;
-      bestGuess = pool[0]; let best = -1;
-      for (const w of pool) {
-        const newV = [...w].filter((c) => VOWELS.has(c) && !knownVowels.has(c)).length;
-        const s = newV * 3 + new Set(w.split('')).size;
-        if (s > best) { best = s; bestGuess = w; }
-      }
+      bestGuess = pickBestVowelWord(pool, knownVowels);
     } else {
       bestGuess = candidates[0];
     }

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott