From cbe51eed48bf248601988dcd9649888b465e316b Mon Sep 17 00:00:00 2001
From: lingdocs <71590811+lingdocs@users.noreply.github.com>
Date: Fri, 9 Sep 2022 19:01:02 +0400
Subject: [PATCH] added verb situations and also stopped using fragments in the
Situations bc it breaks the comparison used in the pool function
---
src/games/games.tsx | 31 +++-
src/games/sub-cores/EquativeSituations.tsx | 36 ++---
src/games/sub-cores/VerbGame.tsx | 22 ++-
src/games/sub-cores/VerbSituations.tsx | 160 +++++++++++++++++++++
4 files changed, 217 insertions(+), 32 deletions(-)
create mode 100644 src/games/sub-cores/VerbSituations.tsx
diff --git a/src/games/games.tsx b/src/games/games.tsx
index b7bd269..28563f0 100644
--- a/src/games/games.tsx
+++ b/src/games/games.tsx
@@ -3,6 +3,7 @@ import VerbGame from "./sub-cores/VerbGame";
import GenderGame from "./sub-cores/GenderGame";
import UnisexNounGame from "./sub-cores/UnisexNounGame";
import EquativeSituations from "./sub-cores/EquativeSituations";
+import VerbSituations from "./sub-cores/VerbSituations";
import EquativeIdentify from "./sub-cores/EquativeIdentify";
// NOUNS
@@ -235,19 +236,40 @@ export const habitualPastVerbGame2 = makeGameRecord({
SubCore: VerbGame,
});
export const allPastVerbGame1 = makeGameRecord({
- title: "Write the past verb (one)",
+ title: "Write the past verb - all past tenses (one)",
id: "all-past-verbs-write-1",
link: "/verbs/past-verbs/",
level: { level: 1, type : "allPast" },
SubCore: VerbGame,
});
export const allPastVerbGame2 = makeGameRecord({
- title: "Write past verb (mix)",
+ title: "Write past verb - all past tenses (mix)",
id: "all-past-verbs-write-2",
link: "/verbs/past-verbs/",
level: { level: 2, type: "allPast" },
SubCore: VerbGame,
});
+export const allVerbGame1 = makeGameRecord({
+ title: "Write verb - all tenses (one)",
+ id: "all-verbs-write-1",
+ link: "/verbs/master-chart/",
+ level: { level: 1, type : "allPast" },
+ SubCore: VerbGame,
+});
+export const allVerbGame2 = makeGameRecord({
+ title: "Write verb - all tenses (mix)",
+ id: "all-verbs-write-2",
+ link: "/verbs/master-chart/",
+ level: { level: 2, type: "allPast" },
+ SubCore: VerbGame,
+});
+export const verbSituationsGame = makeGameRecord({
+ title: "Choose the right verb tense for the situation",
+ id: "verb-tense-situations",
+ link: "/verbs/verbs-intro/",
+ level: "situations",
+ SubCore: VerbSituations,
+});
const games: { chapter: string, items: GameRecord[] }[] = [
{
@@ -297,6 +319,9 @@ const games: { chapter: string, items: GameRecord[] }[] = [
habitualPastVerbGame2,
allPastVerbGame1,
allPastVerbGame2,
+ allVerbGame1,
+ allVerbGame2,
+ verbSituationsGame,
],
},
];
@@ -305,6 +330,8 @@ const games: { chapter: string, items: GameRecord[] }[] = [
games.forEach(({ items }) => {
const allAreUnique = (arr: unknown[]) => arr.length === new Set(arr).size;
const ids = items.map(x => x.id);
+ const title = items.map(x => x.title);
+ if (!allAreUnique(title)) throw new Error("duplicate game title");
if (!allAreUnique(ids)) throw new Error("duplicate game key");
})
diff --git a/src/games/sub-cores/EquativeSituations.tsx b/src/games/sub-cores/EquativeSituations.tsx
index 4e23d1b..dd8adc8 100644
--- a/src/games/sub-cores/EquativeSituations.tsx
+++ b/src/games/sub-cores/EquativeSituations.tsx
@@ -1,5 +1,6 @@
import GameCore from "../GameCore";
import {
+ humanReadableEquativeTense,
Types as T,
} from "@lingdocs/pashto-inflector";
import { makePool } from "../../lib/pool";
@@ -18,43 +19,43 @@ const timeLimit = 100;
const situations: Situation[] = [
{
- description: <>A is B, for sure, right now>,
+ description: "A is B, for sure, right now",
tense: ["present"],
},
{
- description: <>A is probably B, right now>,
+ description: "A is probably B, right now",
tense: ["future"],
},
{
- description: <>A will be B in the future>,
+ description: "A will be B in the future",
tense: ["future"],
},
{
- description: <>We can assume that A is most likely B>,
+ description: "We can assume that A is most likely B",
tense: ["future"],
},
{
- description: <>You know A is B, currently>,
+ description: "You know A is B, currently",
tense: ["present"],
},
{
- description: <>A tends to be B>,
+ description: "A tends to be B",
tense: ["habitual"],
},
{
- description: <>A is usually B>,
+ description: "A is usually B",
tense: ["habitual"],
},
{
- description: <>A is generally B>,
+ description: "A is generally B",
tense: ["habitual"],
},
{
- description: <>A is B, right now>,
+ description: "A is B, right now",
tense: ["present"],
},
{
- description: <>A is always B, as a matter of habit>,
+ description: "A is always B, as a matter of habit",
tense: ["present"],
},
{
@@ -151,7 +152,7 @@ export default function EquativeSituations({ inChapter, id, link, level }: { inC
className="btn btn-outline-secondary mb-3"
onClick={() => handleTenseClick(t)}
>
- {humanReadableTense(t)}
+ {humanReadableEquativeTense(t)}
)}
@@ -182,18 +183,7 @@ function DisplayCorrectAnswer({ question }: { question: Question }): JSX.Element
// {possibleCorrect.map(humanReadableTense).join(" or ")}
// )
return
- {question.tense.map(humanReadableTense).join(" or ")}
+ {question.tense.map(humanReadableEquativeTense).join(" or ")}
;
}
-function humanReadableTense(tense: T.EquativeTense | "allProduce"): string {
- return tense === "allProduce"
- ? ""
- : tense === "pastSubjunctive"
- ? "past subjunctive"
- : tense === "wouldBe"
- ? `"would be"`
- : tense === "wouldHaveBeen"
- ? `"would have been"`
- : tense;
-}
diff --git a/src/games/sub-cores/VerbGame.tsx b/src/games/sub-cores/VerbGame.tsx
index cc0572d..43e07e7 100644
--- a/src/games/sub-cores/VerbGame.tsx
+++ b/src/games/sub-cores/VerbGame.tsx
@@ -93,9 +93,9 @@ type VerbGameLevel = {
type: "presentVerb" | "subjunctiveVerb"
| "futureVerb" | "imperative" | "intransitivePerfectivePast"
| "intransitiveImperfectivePast" | "transitivePerfectivePast" | "transitiveImperfectivePast"
- | "allPast" | "habitualPast";
+ | "allPast" | "habitualPast" | "allTenses";
}
-type VerbPoolName = "basic" | "transitivePast" | "intransitivePast" | "mixedPast";
+type VerbPoolName = "basic" | "transitivePast" | "intransitivePast" | "mixedPast" | "mixedAll";
function selectVerbPool({ type }: VerbGameLevel): VerbPoolName {
return type === "presentVerb"
@@ -114,8 +114,9 @@ function selectVerbPool({ type }: VerbGameLevel): VerbPoolName {
? "transitivePast"
: type === "transitivePerfectivePast"
? "transitivePast"
- // : type === "habitualPast" || type === "allPast"
- : "mixedPast";
+ : type === "habitualPast" || type === "allPast"
+ ? "mixedPast"
+ : "mixedAll";
}
// TODO: Level where you create the formulas (seperate file)
@@ -136,6 +137,7 @@ const VerbGame: GameSubCore = ({ id, link, level, inChapter }: {
transitivePast: makePool(transitivePastVerbs, 15),
intransitivePast: makePool(intransitivePastVerbs, 15),
mixedPast: makePool([...transitivePastVerbs, ...intransitivePastVerbs], 15),
+ mixedAll: makePool([...verbs, ...transitivePastVerbs, ...intransitivePastVerbs], 15),
};
const oneVerb: T.VerbEntry = verbPools[selectVerbPool(level)]();
const getVerb = level.level === 1
@@ -274,8 +276,12 @@ const VerbGame: GameSubCore = ({ id, link, level, inChapter }: {
}
function Instructions() {
+ const desc = levelToDescription(level);
return
-
Write the {levelToDescription(level)} verb to complete the phrase
+
+ Write the {desc} verb to complete the phrase
+ {desc ? "" : " (all tenses)"}
+
}
@@ -397,8 +403,10 @@ function levelToDescription({ type }: VerbGameLevel): string {
? "imperfective imperative or perfective imperative"
: type === "allPast"
? "past tense"
- // : type === "habitualPast"
- : "habitual past";
+ : type === "habitualPast"
+ ? "habitual past"
+ // : type === "allTenses"
+ : "";
}
function levelToTense({ type }: VerbGameLevel): T.VerbTense | T.ImperativeTense {
diff --git a/src/games/sub-cores/VerbSituations.tsx b/src/games/sub-cores/VerbSituations.tsx
new file mode 100644
index 0000000..086478c
--- /dev/null
+++ b/src/games/sub-cores/VerbSituations.tsx
@@ -0,0 +1,160 @@
+import GameCore from "../GameCore";
+import {
+ humanReadableVerbForm,
+ Types as T,
+} from "@lingdocs/pashto-inflector";
+import { makePool } from "../../lib/pool";
+
+const tenses: T.VerbTense[] = [
+ "presentVerb",
+ "subjunctiveVerb",
+ "imperfectiveFuture",
+ "perfectiveFuture",
+ "imperfectivePast",
+ "perfectivePast",
+ "habitualImperfectivePast",
+ "habitualPerfectivePast",
+];
+
+type Situation = {
+ description: string | JSX.Element,
+ tense: T.VerbTense[],
+};
+
+const amount = 12;
+const timeLimit = 100;
+
+const situations: Situation[] = [
+ {
+ description: "Something happens generally",
+ tense: ["presentVerb"],
+ },
+ {
+ description: "Something is happening right now",
+ tense: ["presentVerb"],
+ },
+ {
+ description: "Something is definately about to happen soon",
+ tense: ["presentVerb", "imperfectiveFuture", "perfectiveFuture"],
+ },
+ {
+ description: "...so that something happens",
+ tense: ["subjunctiveVerb"],
+ },
+ {
+ description: "something should happen (judgement/necessity)",
+ tense: ["subjunctiveVerb"],
+ },
+ {
+ description: "you hope that something happens",
+ tense: ["subjunctiveVerb"],
+ },
+ {
+ description: "something will happen",
+ tense: ["imperfectiveFuture", "perfectiveFuture"],
+ },
+ {
+ description: "an action will happen, and be ongoing",
+ tense: ["imperfectiveFuture"],
+ },
+ {
+ description: "an action will happen, and it will just be a one-time, complete action",
+ tense: ["perfectiveFuture"],
+ },
+ {
+ description: "something happened",
+ tense: ["perfectivePast"],
+ },
+ {
+ description: "something was happening",
+ tense: ["imperfectivePast"],
+ },
+ {
+ description: "something was going to happen (but it didn't)",
+ tense: ["imperfectivePast"],
+ },
+ {
+ description: "something would have happened",
+ tense: ["imperfectivePast", "habitualImperfectivePast"],
+ },
+ {
+ description: "something would happen, again and again in the past",
+ tense: ["imperfectivePast", "habitualImperfectivePast", "habitualPerfectivePast"],
+ },
+ {
+ description: "an event was completed, one-time, in the past",
+ tense: ["perfectivePast"],
+ },
+ {
+ description: "something would happen habitually in the past - and each time it was a whole/complete event",
+ tense: ["habitualPerfectivePast"],
+ },
+ {
+ description: "something would happen habitually in the past - and each time it was ongoing/like an action in process",
+ tense: ["habitualImperfectivePast"],
+ },
+];
+
+type Question = Situation;
+
+
+export default function VerbSituations({ inChapter, id, link, level }: { inChapter: boolean, id: string, link: string, level: "situations" }) {
+ const situationsPool = makePool(situations);
+ function getQuestion(): Question {
+ return situationsPool();
+ };
+
+ function Display({ question, callback }: QuestionDisplayProps) {
+
+ function handleTenseClick(t: T.VerbTense) {
+ callback(question.tense.includes(t));
+ }
+ return
+
+
+ {question.description}
+
+
+
+
+ {tenses.map(t =>
+
+
)}
+
+
+
+ }
+
+ function Instructions() {
+ return Choose a verb tense that works for each given situation
;
+ }
+
+ return
+};
+
+function DisplayCorrectAnswer({ question }: { question: Question }): JSX.Element {
+
+ // callback(
+ // {possibleCorrect.map(humanReadableTense).join(" or ")}
+ //
)
+ return
+ {question.tense.map(humanReadableVerbForm).join(" or ")}
+
;
+}
+