debug
This commit is contained in:
parent
9c9fa06588
commit
7b933effa4
|
@ -36,6 +36,7 @@ export default function MinimalPairsGame({
|
|||
minimalPairs.find((x) => x.title === level)?.pairs || []
|
||||
);
|
||||
function getQuestion(): Question {
|
||||
console.log("getting question");
|
||||
const pair = getPair();
|
||||
const selected: 0 | 1 = randFromArray([0, 1]);
|
||||
return { pair, selected };
|
||||
|
|
|
@ -13,9 +13,7 @@ export function makePool<P>(poolBase: P[], removalLaxity = 0): () => P {
|
|||
let pool = [...poolBase];
|
||||
function shouldStillKeepIt() {
|
||||
if (!removalLaxity) return false;
|
||||
const r = Math.random() < removalLaxity / 100;
|
||||
console.log({ r });
|
||||
return r;
|
||||
return Math.random() < removalLaxity / 100;
|
||||
}
|
||||
function pickRandomFromPool(): P {
|
||||
// Pick an item from the pool;
|
||||
|
@ -26,6 +24,7 @@ export function makePool<P>(poolBase: P[], removalLaxity = 0): () => P {
|
|||
return pick;
|
||||
}
|
||||
const index = pool.findIndex((v) => equal(v, pick));
|
||||
console.log({ pool });
|
||||
if (index === -1) throw new Error("could not find pick from pool");
|
||||
pool.splice(index, 1);
|
||||
// If the pool is empty, reset it
|
||||
|
|
Loading…
Reference in New Issue