Skip to content

Commit 4380e72

Browse files
committed
games: Oops Scrabble should use lowercase
1 parent a430f12 commit 4380e72

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/ps/games/scrabble/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ export class Scrabble extends Game<State> {
449449
if (!word) return null;
450450
const dictionary = Dictionaries[dict];
451451
if (!dictionary) throw new Error(`Unrecognized dictionary ${dict}`);
452-
if (word in dictionary) return [1, 0];
452+
if (word.toLowerCase() in dictionary) return [1, 0];
453453
return null;
454454
}
455455

@@ -459,7 +459,7 @@ export class Scrabble extends Game<State> {
459459
const wordsPoints = Object.fromEntries(
460460
words.map(word => {
461461
const scoring = this.checkWord(word.word);
462-
if (!scoring) this.throw('GAME.SCRABBLE.INVALID_WORD');
462+
if (!scoring) this.throw('GAME.SCRABBLE.INVALID_WORD', { word: word.word });
463463
return [word.word, word.bonuses.reduce((score, bonus) => bonus(score), word.baseScore * scoring[0] + scoring[1])];
464464
})
465465
);

0 commit comments

Comments
 (0)