more games

This commit is contained in:
lingdocs 2022-09-03 16:46:16 +04:00
parent 45f901fb62
commit 6ba1fa0c11
8 changed files with 205 additions and 90 deletions

View File

@ -19,7 +19,7 @@ export const intransitivePastVerbs: T.VerbEntry[] = [
{"ts":1527812645,"i":10822,"p":"ګرځېدل","f":"gurdzedul","g":"gurdzedul","e":"to walk, wander, turn about; to become, to be","c":"v. intrans.","shortIntrans":true,"ec":"walk"},
{"ts":1527816495,"i":3470,"p":"تښتېدل","f":"tuxtedul","g":"tuxtedul","e":"to run off, escape, flee","c":"v. intrans.","shortIntrans":true,"ec":"escape"},
{"ts":1527813680,"i":9218,"p":"غږېدل","f":"ghuGedul, ghaGedul","g":"ghugedul,ghagedul","e":"to speak, talk, converse, sing","c":"v. intrans.","ec":"speak,speaks,speaking,spoke"},
{"ts":1527813994,"i":11589,"p":"لوېدل","f":"lwedul","g":"lwedul","e":"to fall, to tumble, go down, settle","c":"v. intrans.","ec":"fall,falls,falling,fell,fallen"},
{"ts":1527813994,"i":11676,"p":"لوېدل","f":"lwedul","g":"lwedul","e":"to fall, to tumble, go down, settle","c":"v. intrans.","tppp":"لوېد","tppf":"lwed","ec":"fall,falls,falling,fell,fallen"},
{"ts":1527815216,"i":6630,"p":"راتلل","f":"raatlúl","g":"raatlul","e":"to come","c":"v. intrans. irreg.","psp":"راځ","psf":"raadz","ssp":"راش","ssf":"ráash","prp":"راغلل","prf":"ráaghlul","pprtp":"راغلی","pprtf":"raaghúley","tppp":"راغی","tppf":"ráaghey","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"come,comes,coming,came,come"},
{"ts":1527813710,"i":7321,"p":"زېږېدل","f":"zeGedul","g":"zegedul","e":"to be born, to appear, arise","c":"v. intrans.","ec":"be","ep":"born"},
].map(entry => ({ entry }));

View File

@ -15,7 +15,8 @@ import imperfectiveFuture from "./imperfective-future-graph.svg";
import perfectiveFuture from "./perfective-future-graph.svg";
import BasicVerbShowCase from "../../components/BasicVerbShowCase";
import {
futureVerbGame,
futureVerbGame1,
futureVerbGame2,
} from "../../games/games";
import GameDisplay from "../../games/GameDisplay";
@ -56,4 +57,6 @@ This is used to talk about something happening in the future, while thinking of
<BasicVerbShowCase opts={opts} tense="perfectiveFuture" />
<GameDisplay record={futureVerbGame} />
<GameDisplay record={futureVerbGame1} />
<GameDisplay record={futureVerbGame2} />

View File

@ -18,7 +18,8 @@ import imperfectiveImperative from "./imperfective-imperative.svg";
import perfectiveImperative from "./perfective-imperative.svg";
import BasicVerbShowCase from "../../components/BasicVerbShowCase";
import {
imperativeVerbGame,
imperativeVerbGame1,
imperativeVerbGame2,
} from "../../games/games";
import GameDisplay from "../../games/GameDisplay";
@ -182,7 +183,9 @@ You will notice there are only two <Link to="/verbs/verb-endings/#imperative-ver
</table>
</div>
<GameDisplay record={imperativeVerbGame} />
<GameDisplay record={imperativeVerbGame1} />
<GameDisplay record={imperativeVerbGame2} />
## Negative Imperatives

View File

@ -14,7 +14,8 @@ import realityGraph from "./reality-graph.svg";
import presentTime from "./present-time.svg";
import BasicVerbShowCase from "./../../components/BasicVerbShowCase";
import {
presentVerbGame,
presentVerbGame1,
presentVerbGame2,
} from "../../games/games";
import GameDisplay from "../../games/GameDisplay";
@ -122,6 +123,8 @@ Here are some examples of how the present form is used in different situations:
},
])}</Examples>
<GameDisplay record={presentVerbGame} />
<GameDisplay record={presentVerbGame1} />
<GameDisplay record={presentVerbGame2} />

View File

@ -16,7 +16,8 @@ import presentInReality from "./present-in-reality.svg";
import subjunctiveAboveReality from "./subjunctive-above-reality.svg";
import BasicVerbShowCase from "../../components/BasicVerbShowCase";
import {
subjunctiveVerbGame,
subjunctiveVerbGame1,
subjunctiveVerbGame2,
} from "../../games/games";
import GameDisplay from "../../games/GameDisplay";
@ -108,4 +109,6 @@ As you can see, the subjunctive is often used in [subordinate clauses](https://e
...etc.
<GameDisplay record={subjunctiveVerbGame} />
<GameDisplay record={subjunctiveVerbGame1} />
<GameDisplay record={subjunctiveVerbGame2} />

View File

@ -161,6 +161,15 @@ function GameCore<T>({ inChapter, questions, Display, timeLimit, Instructions, s
? "danger"
: "primary";
const gameRunning = current && finish === undefined;
function ActionButtons() {
return <div>
{!inChapter && <Link to={studyLink}>
<button className="btn btn-danger mt-4 mx-3">Study</button>
</Link>}
<button className="btn btn-warning mt-4 mx-3" onClick={() => handleRestart("practice")}>Practice</button>
<button className="btn btn-success mt-4 mx-3" onClick={() => handleRestart("test")}>Test</button>
</div>;
}
return <>
<div className="text-center" style={{ minHeight: "200px", zIndex: 10, position: "relative" }}>
{mode === "test" && <div className="progress" style={{ height: "5px" }}>
@ -200,13 +209,7 @@ function GameCore<T>({ inChapter, questions, Display, timeLimit, Instructions, s
{/* TODO: ADD IN TEXT DISPLAY OPTIONS HERE TOO - WHEN WE START USING THEM*/}
<Instructions />
</div>
<div>
{!inChapter && <Link to={studyLink}>
<button className="btn btn-danger mt-4 mx-3">Study</button>
</Link>}
<button className="btn btn-warning mt-4 mx-3" onClick={() => handleRestart("practice")}>Practice</button>
<button className="btn btn-success mt-4 mx-3" onClick={() => handleRestart("test")}>Test</button>
</div>
<ActionButtons />
</div>)
}
{finish === "pass" && <div>
@ -224,14 +227,7 @@ function GameCore<T>({ inChapter, questions, Display, timeLimit, Instructions, s
</div>
</div>}
<div className="mt-3">
<button className="btn btn-light mx-2" onClick={() => handleRestart("practice")}>Practice</button>
<button className="btn btn-success mx-2" onClick={() => handleRestart("test")}>Test</button>
<button className="btn btn-danger mx-2" onClick={handleQuit}>Quit</button>
</div>
<div onClick={handleQuit} className="my-3">
<Link to={studyLink}>
<button className="btn btn-outline-secondary"><span role="img" aria-label="">📚</span> Study more</button>
</Link>
<ActionButtons />
</div>
</div>}
</div>

View File

@ -106,46 +106,116 @@ export const equativeGameAllProduce = makeGameRecord({
});
// VERBS
export const presentVerbGame = makeGameRecord({
title: "Write the present verb",
id: "present-verbs-write",
export const presentVerbGame1 = makeGameRecord({
title: "Write the present verb (one)",
id: "present-verbs-write-1",
link: "/verbs/present-verbs/",
level: "presentVerb",
level: { level: 1, type :"presentVerb" },
SubCore: VerbGame,
});
export const subjunctiveVerbGame = makeGameRecord({
title: "Write the subjunctive verb",
id: "subjunctive-verbs-write",
export const presentVerbGame2 = makeGameRecord({
title: "Write the present verb (mix)",
id: "present-verbs-write-2",
link: "/verbs/present-verbs/",
level: { level: 2, type :"presentVerb" },
SubCore: VerbGame,
});
export const subjunctiveVerbGame1 = makeGameRecord({
title: "Write the subjunctive verb (one)",
id: "subjunctive-verbs-write-1",
link: "/verbs/subjunctive-verbs/",
level: "subjunctiveVerb",
level: { level: 1, type :"subjunctiveVerb" },
SubCore: VerbGame,
});
export const futureVerbGame = makeGameRecord({
title: "Write the future verb",
id: "future-verbs-write",
export const subjunctiveVerbGame2 = makeGameRecord({
title: "Write the subjunctive verb (mix)",
id: "subjunctive-verbs-write-2",
link: "/verbs/subjunctive-verbs/",
level: { level: 2, type :"subjunctiveVerb" },
SubCore: VerbGame,
});
export const futureVerbGame1 = makeGameRecord({
title: "Write the future verb (one)",
id: "future-verbs-write-1",
link: "/verbs/future-verbs/",
level: "futureVerb",
level: { level: 1, type :"futureVerb" },
SubCore: VerbGame,
});
export const imperativeVerbGame = makeGameRecord({
title: "Write the imperative verb",
id: "imperative-verbs-write",
export const futureVerbGame2 = makeGameRecord({
title: "Write the future verb (mix)",
id: "future-verbs-write-2",
link: "/verbs/future-verbs/",
level: { level: 2, type :"futureVerb" },
SubCore: VerbGame,
});
export const imperativeVerbGame1 = makeGameRecord({
title: "Write the imperative verb (one)",
id: "imperative-verbs-write-1",
link: "/verbs/imperative-verbs/",
level: "imperative",
level: { level: 1, type :"imperative" },
SubCore: VerbGame,
});
export const intransitivePerfectivePastVerbGame = makeGameRecord({
title: "Write the intransitive simple past verb",
id: "intransitive-perfective-past-verbs-write",
link: "/verbs/past-verbs/#past-tense-with-transitive-verbs-",
level: "intransitivePerfectivePast",
export const imperativeVerbGame2 = makeGameRecord({
title: "Write the imperative verb (mix)",
id: "imperative-verbs-write-2",
link: "/verbs/imperative-verbs/",
level: { level: 2, type :"imperative" },
SubCore: VerbGame,
});
export const intransitiveImperfectivePastVerbGame = makeGameRecord({
title: "Write the intransitive continuous past verb",
id: "transitive-imperfective-past-verbs-write",
export const intransitivePerfectivePastVerbGame1 = makeGameRecord({
title: "Write the intransitive simple past verb (one)",
id: "intransitive-perfective-past-verbs-write-1",
link: "/verbs/past-verbs/#past-tense-with-intransitive-verbs-",
level: { level: 1, type :"intransitivePerfectivePast" },
SubCore: VerbGame,
});
export const intransitivePerfectivePastVerbGame2 = makeGameRecord({
title: "Write the intransitive simple past verb (mix)",
id: "intransitive-perfective-past-verbs-write-2",
link: "/verbs/past-verbs/#past-tense-with-intransitive-verbs-",
level: { level: 2, type :"intransitivePerfectivePast" },
SubCore: VerbGame,
});
export const intransitiveImperfectivePastVerbGame1 = makeGameRecord({
title: "Write the intransitive continuous past verb (one)",
id: "intransitive-imperfective-past-verbs-write-1",
link: "/verbs/past-verbs/#past-tense-with-intransitive-verbs-",
level: { level: 1, type :"intransitiveImperfectivePast" },
SubCore: VerbGame,
});
export const intransitiveImperfectivePastVerbGame2 = makeGameRecord({
title: "Write the intransitive continuous past verb (mix)",
id: "intransitive-imperfective-past-verbs-write-2",
link: "/verbs/past-verbs/#past-tense-with-intransitive-verbs-",
level: { level: 2, type :"intransitiveImperfectivePast" },
SubCore: VerbGame,
});
export const transitivePerfectivePastVerbGame1 = makeGameRecord({
title: "Write the transitive simple past verb (one)",
id: "transitive-perfective-past-verbs-write-1",
link: "/verbs/past-verbs/#past-tense-with-transitive-verbs-",
level: "intransitiveImperfectivePast",
level: { level: 1, type :"transitivePerfectivePast" },
SubCore: VerbGame,
});
export const transitivePerfectivePastVerbGame2 = makeGameRecord({
title: "Write the transitive simple past verb (mix)",
id: "transitive-perfective-past-verbs-write-2",
link: "/verbs/past-verbs/#past-tense-with-transitive-verbs-",
level: { level: 2, type :"transitivePerfectivePast" },
SubCore: VerbGame,
});
export const transitiveImperfectivePastVerbGame1 = makeGameRecord({
title: "Write the transitive continuous past verb (one)",
id: "transitive-imperfective-past-verbs-write-1",
link: "/verbs/past-verbs/#past-tense-with-transitive-verbs-",
level: { level: 1, type :"transitiveImperfectivePast" },
SubCore: VerbGame,
});
export const transitiveImperfectivePastVerbGame2 = makeGameRecord({
title: "Write the transitive continuous past verb (mix)",
id: "transitive-imperfective-past-verbs-write-2",
link: "/verbs/past-verbs/#past-tense-with-transitive-verbs-",
level: { level: 2, type :"transitiveImperfectivePast" },
SubCore: VerbGame,
});
@ -177,12 +247,22 @@ const games: { chapter: string, items: GameRecord[] }[] = [
{
chapter: "Verbs",
items: [
presentVerbGame,
subjunctiveVerbGame,
futureVerbGame,
imperativeVerbGame,
intransitiveImperfectivePastVerbGame,
intransitivePerfectivePastVerbGame,
presentVerbGame1,
presentVerbGame2,
subjunctiveVerbGame1,
subjunctiveVerbGame2,
futureVerbGame1,
futureVerbGame2,
imperativeVerbGame1,
imperativeVerbGame2,
intransitiveImperfectivePastVerbGame1,
intransitiveImperfectivePastVerbGame2,
intransitivePerfectivePastVerbGame1,
intransitivePerfectivePastVerbGame2,
transitiveImperfectivePastVerbGame1,
transitiveImperfectivePastVerbGame2,
transitivePerfectivePastVerbGame1,
transitivePerfectivePastVerbGame2,
],
}
];

View File

@ -30,7 +30,7 @@ import {
kidsBlank,
isPashtoScript,
} from "@lingdocs/pashto-inflector";
import { isThirdPerson } from "@lingdocs/pashto-inflector/dist/lib/phrase-building/vp-tools";
import { isPastTense, isThirdPerson } from "@lingdocs/pashto-inflector/dist/lib/phrase-building/vp-tools";
import { maybeShuffleArray } from "../../lib/shuffle-array";
import { getVerbFromBlocks } from "@lingdocs/pashto-inflector/dist/lib/phrase-building/blocks-utils";
import { baParticle } from "@lingdocs/pashto-inflector/dist/lib/grammar-units";
@ -47,6 +47,13 @@ type Question = {
phrase: { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string[] },
};
const transitivePastVerbs: T.VerbEntry[] = [
{"ts":1527812275,"i":11698,"p":"لیدل","f":"leedul","g":"leedul","e":"to see","c":"v. trans./gramm. trans.","psp":"وین","psf":"ween","tppp":"لید","tppf":"leed","ec":"see,sees,seeing,saw,seen"},
{"ts":1527815399,"i":14594,"p":"وهل","f":"wahul","g":"wahul","e":"to hit","c":"v. trans.","tppp":"واهه","tppf":"waahu","ec":"hit,hits,hitting,hit,hit"},
{"ts":1527812790,"i":5840,"p":"خوړل","f":"khoRul","g":"khoRul","e":"to eat, to bite","c":"v. trans.","psp":"خور","psf":"khor","tppp":"خوړ","tppf":"khoR","ec":"eat,eats,eating,ate,eaten"},
{"ts":1527814596,"i":8398,"p":"شرمول","f":"shărmawul","g":"sharmawul","e":"to shame, to disgrace, to dishonor","c":"v. trans.","ec":"embarrass"},
].map(entry => ({ entry })) as T.VerbEntry[]
const verbs: T.VerbEntry[] = [
{"ts":1527812856,"i":11630,"p":"لیکل","f":"leekul","g":"leekul","e":"to write, draw","c":"v. trans./gramm. trans.","ec":"write,writes,writing,wrote,written"},
{"ts":1527815399,"i":14480,"p":"وهل","f":"wahul","g":"wahul","e":"to hit","c":"v. trans.","tppp":"واهه","tppf":"waahu","ec":"hit,hits,hitting,hit,hit"},
@ -90,8 +97,13 @@ const secondPersons = [
T.Person.SecondPlurFemale,
];
type VerbGameLevel = "presentVerb" | "subjunctiveVerb"
| "futureVerb" | "imperative" | "intransitivePerfectivePast" | "intransitiveImperfectivePast";
type VerbGameLevel = {
/* 1 is just a single verb, 2 picks a random verb for every question */
level: 1 | 2,
type: "presentVerb" | "subjunctiveVerb"
| "futureVerb" | "imperative" | "intransitivePerfectivePast"
| "intransitiveImperfectivePast" | "transitivePerfectivePast" | "transitiveImperfectivePast";
}
const VerbGame: GameSubCore<VerbGameLevel> = ({ id, link, level, inChapter }: {
inChapter: boolean,
@ -100,16 +112,20 @@ const VerbGame: GameSubCore<VerbGameLevel> = ({ id, link, level, inChapter }: {
level: VerbGameLevel,
}) => {
function* questions (): Generator<Current<Question>> {
const personPool = makePool(level === "imperative"
const personPool = makePool(level.type === "imperative"
? secondPersons
: persons
);
const verbPool = makePool(
level.includes("intransitive")
? intransitivePastVerbs
: verbs,
30,
);
const verbsUsed = level.type.startsWith("intransitive")
? intransitivePastVerbs
: level.type.startsWith("transitive")
? transitivePastVerbs
: verbs;
const oneVerb = randFromArray(verbsUsed);
const verbPool = makePool(verbsUsed, 15);
const getVerb = level.level === 1
? () => oneVerb
: () => verbPool();
function makeRandomNoun(): T.NounSelection {
const n = makeNounSelection(randFromArray(nouns), undefined);
return {
@ -142,21 +158,24 @@ const VerbGame: GameSubCore<VerbGameLevel> = ({ id, link, level, inChapter }: {
distance: randFromArray(["far", "near", "far"]),
};
}
const verb = verbPool();
const subj = personPool();
let obj: T.Person;
const verb = getVerb();
const king = personPool();
let servant: T.Person;
do {
obj = randomPerson();
} while (isInvalidSubjObjCombo(subj, obj));
servant = randomPerson();
} while (isInvalidSubjObjCombo(king, servant));
// const tense = (l === "allIdentify" || l === "allProduce")
// ? randFromArray(tenses)
// : l;
const tense = l;
return makeVPS({
verb,
subject: personToNPSelection(subj),
object: personToNPSelection(obj),
king: personToNPSelection(king),
servant: personToNPSelection(servant),
tense,
defaultTransitivity: level.type.startsWith("transitive")
? "transitive"
: "grammatically transitive",
});
}
for (let i = 0; i < amount; i++) {
@ -345,45 +364,53 @@ function addUserAnswer(a: { withBa: boolean, answer: string }, ps: T.PsString):
}
function levelToDescription(level: VerbGameLevel): string {
return level === "presentVerb"
function levelToDescription({ type }: VerbGameLevel): string {
return type === "presentVerb"
? "present"
: level === "subjunctiveVerb"
: type === "subjunctiveVerb"
? "subjunctive"
: level === "futureVerb"
: type === "futureVerb"
? "imperfective future or perfective future"
: level === "intransitivePerfectivePast"
: type === "intransitivePerfectivePast"
? "simple past intransitive"
: level === "intransitiveImperfectivePast"
: type === "intransitiveImperfectivePast"
? "continuous past intransitive"
: type === "transitiveImperfectivePast"
? "continuous past transitive"
: type === "transitivePerfectivePast"
? "simple past transitive"
: "imperfective imperative or perfective imperative";
}
function levelToTense(level: VerbGameLevel): T.VerbTense | T.ImperativeTense {
return level === "presentVerb"
? level
: level === "subjunctiveVerb"
? level
: level === "futureVerb"
function levelToTense({ type }: VerbGameLevel): T.VerbTense | T.ImperativeTense {
return type === "presentVerb"
? type
: type === "subjunctiveVerb"
? type
: type === "futureVerb"
? randFromArray(["perfectiveFuture", "imperfectiveFuture"])
: level === "imperative"
: type === "imperative"
? randFromArray(["perfectiveImperative", "imperfectiveImperative"])
: level.includes("ImperfectivePast")
: type.includes("ImperfectivePast")
? "imperfectivePast"
// : level.includes("perfectivePast")
: "perfectivePast";
}
function makeVPS({ verb, subject, object, tense }: {
function makeVPS({ verb, king, servant, tense, defaultTransitivity }: {
verb: T.VerbEntry,
subject: T.NPSelection,
object: T.NPSelection,
king: T.NPSelection,
servant: T.NPSelection,
tense: T.VerbTense | T.ImperativeTense,
defaultTransitivity: "transitive" | "grammatically transitive"
}): T.VPSelectionComplete {
const vps = makeVPSelectionState(verb);
const transitivity = (vps.verb.transitivity === "transitive" && vps.verb.canChangeTransitivity)
? "grammatically transitive"
? defaultTransitivity
: vps.verb.transitivity;
const ergative = vps.verb.transitivity !== "intransitive" && isPastTense(tense);
const subject = ergative ? servant : king;
const object = ergative ? king : servant;
return {
...vps,
verb: {