Fixed the main dictionary file

Set the guess limit at 6
Added 7 letter words
This commit is contained in:
Leon Mika 2025-03-14 21:33:44 +11:00
parent 947ed37974
commit 1367d99446
8 changed files with 1201 additions and 48 deletions

View file

@ -26,7 +26,7 @@ class ProgressionState {
let prog = {
shuffleId: shuffleId,
wordLength: 4,
wordIndex: {"4": 0, "5": 0, "6": 0},
wordIndex: {"4": 0, "5": 0, "6": 0, "7": 0},
currentGuesses: []
};
localStorage.setItem('progression', JSON.stringify(prog));
@ -53,7 +53,7 @@ export class GameController {
}
this._currentWord = await this._wordSource.getCurrentWord(prog);
this._guesses = Math.max(this._currentWord.length, 5) + 1;
this._guesses = 6;
console.log("The current word: " + this._currentWord);
}
@ -88,13 +88,17 @@ export class GameController {
// Increment the progress
let prog = this._progressionState.getProgression();
prog.wordIndex[prog.wordLength + ""] += 1;
prog.wordLength = (((Math.random() * 23) | 0) / 10 | 0) + 4;
//prog.wordLength = (((Math.random() * 23) | 0) / 10 | 0) + 4;
prog.wordLength = ((Math.random() * 4) | 0) + 4;
prog.currentGuesses = [];
prog.wasWin = false;
this._progressionState.saveProgression(prog);
this._currentWord = await this._wordSource.getCurrentWord(prog);
this._guesses = Math.max(this._currentWord.length, 5) + 1;
//this._guesses = Math.max(this._currentWord.length, 5) + 1;
this._guesses = 6;
return true;
}
@ -145,19 +149,19 @@ export class GameController {
let misses = {};
let hits = {};
if (this._currentWord.length <= 5) {
if (!this._wordSource.isWord(guess)) {
hits = {};
for (let i = 0; i < guess.length; i++) {
hits[guess[i]] = MARKERS.ATTEMPTED;
}
return {
hits: hits,
guessResult: GUESS_RESULT.FOUL,
};
}
}
// if (this._currentWord.length <= 5) {
// if (!this._wordSource.isWord(guess)) {
// hits = {};
// for (let i = 0; i < guess.length; i++) {
// hits[guess[i]] = MARKERS.ATTEMPTED;
// }
//
// return {
// hits: hits,
// guessResult: GUESS_RESULT.FOUL,
// };
// }
// }
for (let i = 0; i < guess.length; i++) {
if (guess[i] == this._currentWord[i]) {