fix game jam
This commit is contained in:
parent
5210dfa3d4
commit
f250acc4b1
|
@ -15,6 +15,8 @@ import {
|
||||||
firstVariation,
|
firstVariation,
|
||||||
} from "../lib/text-tools";
|
} from "../lib/text-tools";
|
||||||
|
|
||||||
|
const genders: T.Gender[] = ["masc", "fem"];
|
||||||
|
|
||||||
// const masc = words.filter((w) => w.entry.c === "n. m.");
|
// const masc = words.filter((w) => w.entry.c === "n. m.");
|
||||||
// const fem = words.filter((w) => w.entry.c === "n. f.");
|
// const fem = words.filter((w) => w.entry.c === "n. f.");
|
||||||
type CategorySet = Record<string, { category: string, def: string, entry: T.DictionaryEntry }[]>;
|
type CategorySet = Record<string, { category: string, def: string, entry: T.DictionaryEntry }[]>;
|
||||||
|
@ -51,15 +53,16 @@ const amount = 40;
|
||||||
export default function({level}: { level: 1 | 2 }) {
|
export default function({level}: { level: 1 | 2 }) {
|
||||||
function* questions () {
|
function* questions () {
|
||||||
const wordPool = {...types};
|
const wordPool = {...types};
|
||||||
|
const exceptionsPool = {...exceptions};
|
||||||
for (let i = 0; i < amount; i++) {
|
for (let i = 0; i < amount; i++) {
|
||||||
const base = level === 1
|
const base = level === 1
|
||||||
? wordPool
|
? wordPool
|
||||||
: getRandomFromList([wordPool, exceptions]);
|
: getRandomFromList([wordPool, exceptionsPool]);
|
||||||
const gender = getRandomFromList(Object.keys(base));
|
const gender = getRandomFromList(genders);
|
||||||
let typeToUse: string;
|
let typeToUse: string;
|
||||||
do {
|
do {
|
||||||
typeToUse = getRandomFromList(Object.keys(base[gender]));
|
typeToUse = getRandomFromList(Object.keys(base[gender]));
|
||||||
} while (!base[gender].length);
|
} while (!base[gender][typeToUse].length);
|
||||||
const question = getRandomFromList(base[gender][typeToUse]).entry;
|
const question = getRandomFromList(base[gender][typeToUse]).entry;
|
||||||
base[gender][typeToUse] = base[gender][typeToUse].filter(({ entry }) => entry.ts !== question.ts);
|
base[gender][typeToUse] = base[gender][typeToUse].filter(({ entry }) => entry.ts !== question.ts);
|
||||||
yield {
|
yield {
|
||||||
|
|
|
@ -104,9 +104,9 @@ export default function() {
|
||||||
value={answer}
|
value={answer}
|
||||||
onChange={handleInput}
|
onChange={handleInput}
|
||||||
/>
|
/>
|
||||||
|
<div className="text-muted small mt-3">
|
||||||
|
Type <kbd>Enter</kbd> to check
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<button type="submit" className="btn btn-primary">Check</button>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ module.exports = [
|
||||||
{ ts: 1575924767041, e: `shepherd` }, // شپون - shpoon
|
{ ts: 1575924767041, e: `shepherd` }, // شپون - shpoon
|
||||||
{ ts: 1527815279, e: `shepherd` }, // شپونکی - shpoonkey
|
{ ts: 1527815279, e: `shepherd` }, // شپونکی - shpoonkey
|
||||||
{ ts: 1527819173, e: `analyst, examiner` }, // شنونکی - shanóonkey
|
{ ts: 1527819173, e: `analyst, examiner` }, // شنونکی - shanóonkey
|
||||||
{ ts: 1612614411126, e: `teacher` }, // ښووونکی - xowóonkey
|
{ ts: 1527812806, e: `teacher` }, // ښووونکی - xowóonkey
|
||||||
{ ts: 1527815436, e: `tyrant, oppressor, cruel person` }, // ظالم - zaalim
|
{ ts: 1527815436, e: `tyrant, oppressor, cruel person` }, // ظالم - zaalim
|
||||||
{ ts: 1527818632, e: `twin` }, // غبرګونی - ghbargoney
|
{ ts: 1527818632, e: `twin` }, // غبرګونی - ghbargoney
|
||||||
{ ts: 1527812624, e: `thief` }, // غل - ghul
|
{ ts: 1527812624, e: `thief` }, // غل - ghul
|
||||||
|
|
Loading…
Reference in New Issue