diff --git a/src/content/equatives/other-equatives.mdx b/src/content/equatives/other-equatives.mdx index e5b5e8a..7b0331b 100644 --- a/src/content/equatives/other-equatives.mdx +++ b/src/content/equatives/other-equatives.mdx @@ -345,8 +345,8 @@ Like the past equative that it's based on, it's {psmd([ { - p: "زه به هر سهار هلته وم", - f: "zu ba hăr saháar halta wum", + p: "زه **به** هر سهار هلته **وم**", + f: "zu **ba** hăr saháar halta **wum**", e: "I would be there every morning", }, { diff --git a/src/games/GamesBrowser.tsx b/src/games/GamesBrowser.tsx index 33ddf09..14708fd 100644 --- a/src/games/GamesBrowser.tsx +++ b/src/games/GamesBrowser.tsx @@ -14,18 +14,18 @@ function GamesBrowser() { } return
{games.map((chapter) => ( - <> -

{chapter.chapter}

+
+

{chapter.chapter}

{chapter.items.map(({ id, title, Game, studyLink }) => { const done = user && user.tests.some(t => t.id === id); const open = opened === id; return
-

handleTitleClick(id)}> +

handleTitleClick(id)}> {title} {` `} -
+

@@ -41,7 +41,7 @@ function GamesBrowser() {

})} - +
))}
} diff --git a/src/games/games.tsx b/src/games/games.tsx index 3915fd0..872ca34 100644 --- a/src/games/games.tsx +++ b/src/games/games.tsx @@ -39,49 +39,56 @@ export const equativeGamePresent = makeGameRecord( "Write the present equative", "equative-present", "/equatives/present-equative/", - (id, link) => (s: (a: "start" | "stop") => void) => , + (id, link) => (s: (a: "start" | "stop") => void) => , ); export const equativeGameHabitual = makeGameRecord( "Write the habitual equative", "equative-habitual", "/equatives/habitual-equative/", - (id, link) => (s: (a: "start" | "stop") => void) => , + (id, link) => (s: (a: "start" | "stop") => void) => , ); export const equativeGameSubjunctive = makeGameRecord( "Write the subjunctive equative", "equative-subjunctive", "/equatives/other-equatives/#subjunctive-equative", - (id, link) => (s: (a: "start" | "stop") => void) => , + (id, link) => (s: (a: "start" | "stop") => void) => , ); export const equativeGameFuture = makeGameRecord( "Write the future equative", "equative-future", "/equatives/other-equatives/#future-equative", - (id, link) => (s: (a: "start" | "stop") => void) => , + (id, link) => (s: (a: "start" | "stop") => void) => , ); export const equativeGamePast = makeGameRecord( "Write the past equative", "equative-past", "/equatives/other-equatives/#past-equative", - (id, link) => (s: (a: "start" | "stop") => void) => , + (id, link) => (s: (a: "start" | "stop") => void) => , ); export const equativeGameWouldBe = makeGameRecord( 'Write the "would be" equative', "equative-would-be", - "equatives/other-equatives/#would-be-equative", - (id, link) => (s: (a: "start" | "stop") => void) => , + "/equatives/other-equatives/#would-be-equative", + (id, link) => (s: (a: "start" | "stop") => void) => , ); export const equativeGamePastSubjunctive = makeGameRecord( 'Write the past subjunctive equative', "equative-past-subjunctive", "/equatives/other-equatives/#past-subjunctive", - (id, link) => (s: (a: "start" | "stop") => void) => , + (id, link) => (s: (a: "start" | "stop") => void) => , +); + +export const equativeGameAll = makeGameRecord( + 'Write the equative (summary)', + "equative-past-summary", + "/equatives/other-equatives", + (id, link) => (s: (a: "start" | "stop") => void) => , ); const games: { chapter: string, items: GameRecord[] }[] = [ @@ -103,6 +110,7 @@ const games: { chapter: string, items: GameRecord[] }[] = [ equativeGamePast, equativeGameWouldBe, equativeGamePastSubjunctive, + equativeGameAll, ], }, ]; diff --git a/src/games/sub-cores/EquativeGame.tsx b/src/games/sub-cores/EquativeGame.tsx index 8c33c5f..9f2ecee 100644 --- a/src/games/sub-cores/EquativeGame.tsx +++ b/src/games/sub-cores/EquativeGame.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import { makeProgress, } from "../../lib/game-utils"; @@ -44,13 +44,17 @@ const locAdverbs: T.LocativeAdverbEntry[] = [ {"ts":1527812558,"i":6241,"p":"دلته","f":"dălta","g":"dalta","e":"here","c":"loc. adv."}, {"ts":1527812449,"i":13937,"p":"هلته","f":"hálta, álta","g":"halta,alta","e":"there","c":"loc. adv."}, ].filter(tp.isLocativeAdverbEntry); +const tenses: T.EquativeTense[] = [ + "present", "habitual", "subjunctive", "future", "past", "wouldBe", "pastSubjunctive", +]; const amount = 20; -const timeLimit = 55; +const timeLimit = 75; type Question = { phrase: { ps: T.PsString, e?: string[] }, equative: T.EquativeRendered, + tense: T.EquativeTense, }; const pronounTypes = [ @@ -63,7 +67,7 @@ const pronounTypes = [ [T.Person.ThirdPlurMale, T.Person.ThirdPlurFemale], ]; -export default function EquativeGame({ id, link, tense, onStartStop }: { id: string, link: string, tense: T.EquativeTense, onStartStop: (a: "start" | "stop") => void }) { +export default function EquativeGame({ id, link, level, onStartStop }: { id: string, link: string, level: T.EquativeTense | "all", onStartStop: (a: "start" | "stop") => void }) { function* questions (): Generator> { let pool = [...pronounTypes]; function makeRandPronoun(): T.PronounSelection { @@ -100,6 +104,7 @@ export default function EquativeGame({ id, link, tense, onStartStop }: { id: str makeRandPronoun, ])(); const pred = randFromArray([...adjectives, ...locAdverbs]); + const tense = level === "all" ? randFromArray(tenses) : level; const EPS = makeEPS(subj, pred, tense); const rendered = renderEP(EPS); const compiled = compileEP(rendered, true, { equative: true, ba: false, kidsSection: true }); @@ -112,6 +117,7 @@ export default function EquativeGame({ id, link, tense, onStartStop }: { id: str question: { phrase, equative: rendered.equative, + tense, }, }; }; @@ -132,32 +138,34 @@ export default function EquativeGame({ id, link, tense, onStartStop }: { id: str if (correct) { setAnswer(""); } - callback(!correct - ?
-
- {flattenLengths(question.equative.ps).reduce(((accum, curr, i): JSX.Element[] => ( - [ - ...accum, - ...i > 0 ? [ or ] : [], - {curr.p}, - ] - )), [] as JSX.Element[])} -
-
{question.equative.hasBa ? "with" : "without"} a {grammarUnits.baParticle} in the kids' section.
-
- : true); + callback(!correct ? makeCorrectAnswer(question) : true); } + useEffect(() => { + if (level === "all") setWithBa(false); + }, [question]); return
- {/* - @ts-ignore */} - - {question.phrase.e && question.phrase.e.map(e => ( -
{e}
+ {/* @ts-ignore */} + + {question.phrase.e && question.phrase.e.map((e, i) => ( +
{e}
))} +
{humanReadableTense(question.tense)} equative
+
+ setWithBa(e.target.checked)} + /> + +
-
-
- setWithBa(e.target.checked)} - /> - -
-
- {/*
*/} - - {/*
*/} - {/*
- Type Enter to check -
*/} -
+
+ {/*
*/} + + {/*
*/} + {/*
+ Type Enter to check +
*/}
@@ -198,7 +193,8 @@ export default function EquativeGame({ id, link, tense, onStartStop }: { id: str function Instructions() { return
-

Fill in the blank with the correct {humanReadableTense(tense)} equative in Pashto script

+

Fill in the blank with the correct {humanReadableTense(level)} equative in Pashto script

+ {level === "all" &&
⚠ All tenses included...
}
} @@ -208,12 +204,26 @@ export default function EquativeGame({ id, link, tense, onStartStop }: { id: str questions={questions} id={id} Display={Display} - timeLimit={timeLimit} + timeLimit={level === "all" ? timeLimit * 1.4 : timeLimit} Instructions={Instructions} /> }; -function modExs(exs: T.PsString[]): { p: JSX.Element, f: JSX.Element }[] { +function makeCorrectAnswer(question: Question): JSX.Element { + return
+
+ {flattenLengths(question.equative.ps).reduce(((accum, curr, i): JSX.Element[] => ( + [ + ...accum, + ...i > 0 ? [ or ] : [], + {curr.p}, + ] + )), [] as JSX.Element[])} +
+
{question.equative.hasBa ? "with" : "without"} a {grammarUnits.baParticle} in the kids' section.
+
; +} +function modExs(exs: T.PsString[], withBa: boolean): { p: JSX.Element, f: JSX.Element }[] { return exs.map(ps => { if (!ps.p.includes(" ___ ")) { return { @@ -224,14 +234,16 @@ function modExs(exs: T.PsString[]): { p: JSX.Element, f: JSX.Element }[] { const splitP = ps.p.split(" ___ "); const splitF = ps.f.split(" ___ "); return { - p: <>{splitP[0]} ___ {splitP[1]}, - f: <>{splitF[0]} ___ {splitF[1]}, + p: <>{splitP[0]} {withBa ? "به" : "__"} {splitP[1]}, + f: <>{splitF[0]} {withBa ? "ba" : "__"} {splitF[1]}, }; }); } -function humanReadableTense(tense: T.EquativeTense): string { - return tense === "pastSubjunctive" +function humanReadableTense(tense: T.EquativeTense | "all"): string { + return tense === "all" + ? "" + : tense === "pastSubjunctive" ? "past subjunctive" : tense === "wouldBe" ? `"would be"`