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":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":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":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":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"}, {"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 })); ].map(entry => ({ entry }));

View File

@ -15,7 +15,8 @@ import imperfectiveFuture from "./imperfective-future-graph.svg";
import perfectiveFuture from "./perfective-future-graph.svg"; import perfectiveFuture from "./perfective-future-graph.svg";
import BasicVerbShowCase from "../../components/BasicVerbShowCase"; import BasicVerbShowCase from "../../components/BasicVerbShowCase";
import { import {
futureVerbGame, futureVerbGame1,
futureVerbGame2,
} from "../../games/games"; } from "../../games/games";
import GameDisplay from "../../games/GameDisplay"; 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" /> <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 perfectiveImperative from "./perfective-imperative.svg";
import BasicVerbShowCase from "../../components/BasicVerbShowCase"; import BasicVerbShowCase from "../../components/BasicVerbShowCase";
import { import {
imperativeVerbGame, imperativeVerbGame1,
imperativeVerbGame2,
} from "../../games/games"; } from "../../games/games";
import GameDisplay from "../../games/GameDisplay"; import GameDisplay from "../../games/GameDisplay";
@ -182,7 +183,9 @@ You will notice there are only two <Link to="/verbs/verb-endings/#imperative-ver
</table> </table>
</div> </div>
<GameDisplay record={imperativeVerbGame} /> <GameDisplay record={imperativeVerbGame1} />
<GameDisplay record={imperativeVerbGame2} />
## Negative Imperatives ## Negative Imperatives

View File

@ -14,7 +14,8 @@ import realityGraph from "./reality-graph.svg";
import presentTime from "./present-time.svg"; import presentTime from "./present-time.svg";
import BasicVerbShowCase from "./../../components/BasicVerbShowCase"; import BasicVerbShowCase from "./../../components/BasicVerbShowCase";
import { import {
presentVerbGame, presentVerbGame1,
presentVerbGame2,
} from "../../games/games"; } from "../../games/games";
import GameDisplay from "../../games/GameDisplay"; import GameDisplay from "../../games/GameDisplay";
@ -122,6 +123,8 @@ Here are some examples of how the present form is used in different situations:
}, },
])}</Examples> ])}</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 subjunctiveAboveReality from "./subjunctive-above-reality.svg";
import BasicVerbShowCase from "../../components/BasicVerbShowCase"; import BasicVerbShowCase from "../../components/BasicVerbShowCase";
import { import {
subjunctiveVerbGame, subjunctiveVerbGame1,
subjunctiveVerbGame2,
} from "../../games/games"; } from "../../games/games";
import GameDisplay from "../../games/GameDisplay"; import GameDisplay from "../../games/GameDisplay";
@ -108,4 +109,6 @@ As you can see, the subjunctive is often used in [subordinate clauses](https://e
...etc. ...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" ? "danger"
: "primary"; : "primary";
const gameRunning = current && finish === undefined; 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 <> return <>
<div className="text-center" style={{ minHeight: "200px", zIndex: 10, position: "relative" }}> <div className="text-center" style={{ minHeight: "200px", zIndex: 10, position: "relative" }}>
{mode === "test" && <div className="progress" style={{ height: "5px" }}> {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*/} {/* TODO: ADD IN TEXT DISPLAY OPTIONS HERE TOO - WHEN WE START USING THEM*/}
<Instructions /> <Instructions />
</div> </div>
<div> <ActionButtons />
{!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>
</div>) </div>)
} }
{finish === "pass" && <div> {finish === "pass" && <div>
@ -224,14 +227,7 @@ function GameCore<T>({ inChapter, questions, Display, timeLimit, Instructions, s
</div> </div>
</div>} </div>}
<div className="mt-3"> <div className="mt-3">
<button className="btn btn-light mx-2" onClick={() => handleRestart("practice")}>Practice</button> <ActionButtons />
<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>
</div> </div>
</div>} </div>}
</div> </div>

View File

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

View File

@ -30,7 +30,7 @@ import {
kidsBlank, kidsBlank,
isPashtoScript, isPashtoScript,
} from "@lingdocs/pashto-inflector"; } 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 { maybeShuffleArray } from "../../lib/shuffle-array";
import { getVerbFromBlocks } from "@lingdocs/pashto-inflector/dist/lib/phrase-building/blocks-utils"; import { getVerbFromBlocks } from "@lingdocs/pashto-inflector/dist/lib/phrase-building/blocks-utils";
import { baParticle } from "@lingdocs/pashto-inflector/dist/lib/grammar-units"; import { baParticle } from "@lingdocs/pashto-inflector/dist/lib/grammar-units";
@ -47,6 +47,13 @@ type Question = {
phrase: { ps: T.SingleOrLengthOpts<T.PsString[]>, e?: string[] }, 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[] = [ 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":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"}, {"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, T.Person.SecondPlurFemale,
]; ];
type VerbGameLevel = "presentVerb" | "subjunctiveVerb" type VerbGameLevel = {
| "futureVerb" | "imperative" | "intransitivePerfectivePast" | "intransitiveImperfectivePast"; /* 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 }: { const VerbGame: GameSubCore<VerbGameLevel> = ({ id, link, level, inChapter }: {
inChapter: boolean, inChapter: boolean,
@ -100,16 +112,20 @@ const VerbGame: GameSubCore<VerbGameLevel> = ({ id, link, level, inChapter }: {
level: VerbGameLevel, level: VerbGameLevel,
}) => { }) => {
function* questions (): Generator<Current<Question>> { function* questions (): Generator<Current<Question>> {
const personPool = makePool(level === "imperative" const personPool = makePool(level.type === "imperative"
? secondPersons ? secondPersons
: persons : persons
); );
const verbPool = makePool( const verbsUsed = level.type.startsWith("intransitive")
level.includes("intransitive") ? intransitivePastVerbs
? intransitivePastVerbs : level.type.startsWith("transitive")
: verbs, ? transitivePastVerbs
30, : verbs;
); const oneVerb = randFromArray(verbsUsed);
const verbPool = makePool(verbsUsed, 15);
const getVerb = level.level === 1
? () => oneVerb
: () => verbPool();
function makeRandomNoun(): T.NounSelection { function makeRandomNoun(): T.NounSelection {
const n = makeNounSelection(randFromArray(nouns), undefined); const n = makeNounSelection(randFromArray(nouns), undefined);
return { return {
@ -142,21 +158,24 @@ const VerbGame: GameSubCore<VerbGameLevel> = ({ id, link, level, inChapter }: {
distance: randFromArray(["far", "near", "far"]), distance: randFromArray(["far", "near", "far"]),
}; };
} }
const verb = verbPool(); const verb = getVerb();
const subj = personPool(); const king = personPool();
let obj: T.Person; let servant: T.Person;
do { do {
obj = randomPerson(); servant = randomPerson();
} while (isInvalidSubjObjCombo(subj, obj)); } while (isInvalidSubjObjCombo(king, servant));
// const tense = (l === "allIdentify" || l === "allProduce") // const tense = (l === "allIdentify" || l === "allProduce")
// ? randFromArray(tenses) // ? randFromArray(tenses)
// : l; // : l;
const tense = l; const tense = l;
return makeVPS({ return makeVPS({
verb, verb,
subject: personToNPSelection(subj), king: personToNPSelection(king),
object: personToNPSelection(obj), servant: personToNPSelection(servant),
tense, tense,
defaultTransitivity: level.type.startsWith("transitive")
? "transitive"
: "grammatically transitive",
}); });
} }
for (let i = 0; i < amount; i++) { 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 { function levelToDescription({ type }: VerbGameLevel): string {
return level === "presentVerb" return type === "presentVerb"
? "present" ? "present"
: level === "subjunctiveVerb" : type === "subjunctiveVerb"
? "subjunctive" ? "subjunctive"
: level === "futureVerb" : type === "futureVerb"
? "imperfective future or perfective future" ? "imperfective future or perfective future"
: level === "intransitivePerfectivePast" : type === "intransitivePerfectivePast"
? "simple past intransitive" ? "simple past intransitive"
: level === "intransitiveImperfectivePast" : type === "intransitiveImperfectivePast"
? "continuous past intransitive" ? "continuous past intransitive"
: type === "transitiveImperfectivePast"
? "continuous past transitive"
: type === "transitivePerfectivePast"
? "simple past transitive"
: "imperfective imperative or perfective imperative"; : "imperfective imperative or perfective imperative";
} }
function levelToTense(level: VerbGameLevel): T.VerbTense | T.ImperativeTense { function levelToTense({ type }: VerbGameLevel): T.VerbTense | T.ImperativeTense {
return level === "presentVerb" return type === "presentVerb"
? level ? type
: level === "subjunctiveVerb" : type === "subjunctiveVerb"
? level ? type
: level === "futureVerb" : type === "futureVerb"
? randFromArray(["perfectiveFuture", "imperfectiveFuture"]) ? randFromArray(["perfectiveFuture", "imperfectiveFuture"])
: level === "imperative" : type === "imperative"
? randFromArray(["perfectiveImperative", "imperfectiveImperative"]) ? randFromArray(["perfectiveImperative", "imperfectiveImperative"])
: level.includes("ImperfectivePast") : type.includes("ImperfectivePast")
? "imperfectivePast" ? "imperfectivePast"
// : level.includes("perfectivePast") // : level.includes("perfectivePast")
: "perfectivePast"; : "perfectivePast";
} }
function makeVPS({ verb, subject, object, tense }: { function makeVPS({ verb, king, servant, tense, defaultTransitivity }: {
verb: T.VerbEntry, verb: T.VerbEntry,
subject: T.NPSelection, king: T.NPSelection,
object: T.NPSelection, servant: T.NPSelection,
tense: T.VerbTense | T.ImperativeTense, tense: T.VerbTense | T.ImperativeTense,
defaultTransitivity: "transitive" | "grammatically transitive"
}): T.VPSelectionComplete { }): T.VPSelectionComplete {
const vps = makeVPSelectionState(verb); const vps = makeVPSelectionState(verb);
const transitivity = (vps.verb.transitivity === "transitive" && vps.verb.canChangeTransitivity) const transitivity = (vps.verb.transitivity === "transitive" && vps.verb.canChangeTransitivity)
? "grammatically transitive" ? defaultTransitivity
: vps.verb.transitivity; : vps.verb.transitivity;
const ergative = vps.verb.transitivity !== "intransitive" && isPastTense(tense);
const subject = ergative ? servant : king;
const object = ergative ? king : servant;
return { return {
...vps, ...vps,
verb: { verb: {