diff --git a/src/games/GameCore.tsx b/src/games/GameCore.tsx index 6787c52..303a9e1 100644 --- a/src/games/GameCore.tsx +++ b/src/games/GameCore.tsx @@ -226,7 +226,7 @@ function GameCore({ inChapter, questions, Display, timeLimit, Instructions, s {finish?.answer} } -
+
} diff --git a/src/games/sub-cores/VerbGame.tsx b/src/games/sub-cores/VerbGame.tsx index 318c634..c1f1427 100644 --- a/src/games/sub-cores/VerbGame.tsx +++ b/src/games/sub-cores/VerbGame.tsx @@ -75,19 +75,8 @@ const nouns: T.NounEntry[] = [ {"ts":1527812661,"i":13938,"p":"هلک","f":"halík, halúk","g":"halik,haluk","e":"boy, young lad","c":"n. m. anim."}, ].filter(tp.isNounEntry); -const persons = [ - T.Person.FirstSingMale, - T.Person.FirstSingFemale, - T.Person.SecondSingMale, - T.Person.SecondSingFemale, - T.Person.ThirdSingMale, - T.Person.ThirdSingFemale, - T.Person.FirstPlurMale, - T.Person.FirstPlurFemale, - T.Person.SecondPlurMale, - T.Person.SecondPlurFemale, - T.Person.ThirdPlurMale, - T.Person.ThirdPlurFemale, +const persons: T.Person[] = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ]; const secondPersons = [ diff --git a/src/lib/pool.ts b/src/lib/pool.ts index ffb9baf..11c365a 100644 --- a/src/lib/pool.ts +++ b/src/lib/pool.ts @@ -11,6 +11,7 @@ import { randFromArray } from "@lingdocs/pashto-inflector"; export function makePool

(poolBase: P[], removalLaxity = 0): () => P { let pool = [...poolBase]; function shouldStillKeepIt() { + if (!removalLaxity) return false; return Math.random() < (removalLaxity / 100); } function pickRandomFromPool(): P { @@ -18,14 +19,15 @@ export function makePool

(poolBase: P[], removalLaxity = 0): () => P { const pick = randFromArray(pool); // Remove the (first occurance of) the item from the pool // This step might be skipped if the removal laxity is set - if (removalLaxity && !shouldStillKeepIt()) { - const index = pool.findIndex(v => matches(v, pick)) - if (index === -1) throw new Error("could not find pick from pool"); - pool.splice(index, 1); - // If the pool is empty, reset it - if (pool.length === 0) { - pool = [...poolBase]; - } + if (shouldStillKeepIt()) { + return pick; + } + const index = pool.findIndex(v => matches(v, pick)) + if (index === -1) throw new Error("could not find pick from pool"); + pool.splice(index, 1); + // If the pool is empty, reset it + if (pool.length === 0) { + pool = [...poolBase]; } return pick; }