From 4583e733fa506f2526f78c69a4904c4899735c07 Mon Sep 17 00:00:00 2001
From: lingdocs <71590811+lingdocs@users.noreply.github.com>
Date: Mon, 29 Aug 2022 19:00:12 +0400
Subject: [PATCH] future game and verb game cleanup
---
package.json | 2 +-
.../phrase-diagram/BlockDiagram.tsx | 2 +-
src/content/verbs/future-verbs.mdx | 6 ++
src/games/GameCore.tsx | 4 +-
src/games/games.tsx | 7 +++
src/games/sub-cores/EquativeGame.tsx | 2 +-
src/games/sub-cores/VerbGame.tsx | 55 +++++++++++--------
yarn.lock | 8 +--
8 files changed, 54 insertions(+), 32 deletions(-)
diff --git a/package.json b/package.json
index b0e5210..1d93eac 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"@formkit/auto-animate": "^1.0.0-beta.1",
"@fortawesome/fontawesome-free": "^5.15.4",
"@lingdocs/lingdocs-main": "^0.3.1",
- "@lingdocs/pashto-inflector": "^3.7.9",
+ "@lingdocs/pashto-inflector": "^3.8.3",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
diff --git a/src/components/phrase-diagram/BlockDiagram.tsx b/src/components/phrase-diagram/BlockDiagram.tsx
index ba67446..a29ade1 100644
--- a/src/components/phrase-diagram/BlockDiagram.tsx
+++ b/src/components/phrase-diagram/BlockDiagram.tsx
@@ -14,7 +14,7 @@ function BlockDiagram({ opts, children }: {
try {
const rendered = children.type === "AP"
? renderAPSelection(children)
- : renderNPSelection(children, false, false, "subject", "none");
+ : renderNPSelection(children, false, false, "subject", "none", false);
const english = getEnglishFromRendered(rendered);
return
diff --git a/src/content/verbs/future-verbs.mdx b/src/content/verbs/future-verbs.mdx
index c45c025..24342d4 100644
--- a/src/content/verbs/future-verbs.mdx
+++ b/src/content/verbs/future-verbs.mdx
@@ -14,6 +14,10 @@ import Formula from "../../components/formula/Formula";
import imperfectiveFuture from "./imperfective-future-graph.svg";
import perfectiveFuture from "./perfective-future-graph.svg";
import BasicVerbShowCase from "../../components/BasicVerbShowCase";
+import {
+ futureVerbGame,
+} from "../../games/games";
+import GameDisplay from "../../games/GameDisplay";
There are two kinds of future forms in Pashto:
@@ -51,3 +55,5 @@ This is used to talk about something happening in the future, while thinking of
+
+
diff --git a/src/games/GameCore.tsx b/src/games/GameCore.tsx
index ce63a54..c854396 100644
--- a/src/games/GameCore.tsx
+++ b/src/games/GameCore.tsx
@@ -69,6 +69,7 @@ function GameCore
({ questions, Display, timeLimit, Instructions, studyLink, i
setJustStruck(true);
} else {
logGameEvent("fail on game");
+ setJustStruck(false);
setFinish({ msg: "fail", answer: correct });
}
}
@@ -126,7 +127,8 @@ function GameCore({ questions, Display, timeLimit, Instructions, studyLink, i
setTimerKey(prev => prev + 1);
}
function handleTimeOut() {
- logGameEvent("timeout on game")
+ logGameEvent("timeout on game");
+ setJustStruck(false);
setFinish("time out");
navigator.vibrate(errorVibration);
}
diff --git a/src/games/games.tsx b/src/games/games.tsx
index d559998..f0aa2a7 100644
--- a/src/games/games.tsx
+++ b/src/games/games.tsx
@@ -29,6 +29,12 @@ export const subjunctiveVerbGame = makeGameRecord(
"/verbs/subjunctive-verbs/",
(id, link) => () =>
);
+export const futureVerbGame = makeGameRecord(
+ "Write the future verb",
+ "future-verbs-write",
+ "/verbs/future-verbs/",
+ (id, link) => () =>
+);
export const nounGenderGame1 = makeGameRecord(
"Identify Noun Genders - Level 1",
@@ -156,6 +162,7 @@ const games: { chapter: string, items: GameRecord[] }[] = [
items: [
presentVerbGame,
subjunctiveVerbGame,
+ futureVerbGame,
],
}
];
diff --git a/src/games/sub-cores/EquativeGame.tsx b/src/games/sub-cores/EquativeGame.tsx
index 432e3c5..a2905c8 100644
--- a/src/games/sub-cores/EquativeGame.tsx
+++ b/src/games/sub-cores/EquativeGame.tsx
@@ -168,7 +168,7 @@ const situations: Situation[] = [
},
];
-const amount = 15;
+const amount = 12;
const timeLimit = 100;
type Question = {
diff --git a/src/games/sub-cores/VerbGame.tsx b/src/games/sub-cores/VerbGame.tsx
index a88091c..37285cc 100644
--- a/src/games/sub-cores/VerbGame.tsx
+++ b/src/games/sub-cores/VerbGame.tsx
@@ -25,6 +25,7 @@ import {
RootsAndStems,
getVerbInfo,
defaultTextOptions,
+ humanReadableVerbForm,
} from "@lingdocs/pashto-inflector";
import { isThirdPerson } from "@lingdocs/pashto-inflector/dist/lib/phrase-building/vp-tools";
import { maybeShuffleArray } from "../../lib/shuffle-array";
@@ -33,7 +34,7 @@ import { getVerbFromBlocks } from "@lingdocs/pashto-inflector/dist/lib/phrase-bu
const kidsColor = "#017BFE";
const amount = 10;
-const timeLimit = 80;
+const timeLimit = 150;
type Question = {
rendered: T.VPRendered,
@@ -46,6 +47,7 @@ const verbs: T.VerbEntry[] = [
{"ts":1527812275,"i":11608,"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":1577049208257,"i":1068,"p":"اورېدل","f":"awredul","g":"awredul","e":"to hear, listen","c":"v. trans./gramm. trans.","psp":"اور","psf":"awr","tppp":"اورېد","tppf":"awred","ec":"hear,hears,hearing,heard"},
{"ts":1527812790,"i":5813,"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":1527812447,"i":292,"p":"اخستل","f":"akhistúl, akhustúl","g":"akhistul,akhustul","e":"to take, buy, purchase, receive; to shave, cut with scissors","c":"v. trans.","psp":"اخل","psf":"akhl","tppp":"اخست","tppf":"akhist","ec":"take,takes,taking,took,taken"},
].map(entry => ({ entry })) as T.VerbEntry[];
// @ts-ignore
const nouns: T.NounEntry[] = [
@@ -68,7 +70,13 @@ const pronounTypes = [
[T.Person.ThirdPlurMale, T.Person.ThirdPlurFemale],
];
-export default function VerbGame({ id, link, level }: { id: string, link: string, level: T.VerbTense }) {
+type VerbGameLevel = "presentVerb" | "subjunctiveVerb" | "futureVerb";
+
+export default function VerbGame({ id, link, level }: {
+ id: string,
+ link: string,
+ level: VerbGameLevel,
+ }) {
function* questions (): Generator> {
let pool = [...pronounTypes];
function getRandPersFromPool(): T.Person {
@@ -133,13 +141,13 @@ export default function VerbGame({ id, link, level }: { id: string, link: string
});
}
for (let i = 0; i < amount; i++) {
- const VPS = makeRandomVPS(level);
+ const VPS = makeRandomVPS(levelToTense(level));
const VP = renderVP(VPS);
const compiled = compileVP(
VP,
{ removeKing: false, shrinkServant: false },
true,
- "verb",
+ { ba: true, verb: true },
);
const phrase = {
ps: compiled.ps,
@@ -217,7 +225,7 @@ export default function VerbGame({ id, link, level }: { id: string, link: string
function Instructions() {
return
-
Write the {humanReadableVerbTense(level)} verb to complete the phrase
+
Write the {levelToDescription(level)} verb to complete the phrase
}
@@ -242,18 +250,19 @@ function QuestionDisplay({ question }: { question: Question }) {
? infoV.stative
: infoV;
return
-
{vEntry.p} - {removeFVarients(vEntry.f)} "{getEnglishVerb(vEntry)}"
-
+ {vEntry.p} - {removeFVarients(vEntry.f)} "{getEnglishVerb(vEntry)}"
+
🌳 Show roots and stems
- {ps.p}
- {ps.f}
+ {ps.p}
+ {ps.f}
{question.phrase.e &&
{question.phrase.e.map(x =>
{x}
)}
}
+ {humanReadableVerbForm(v.block.tense)}
;
}
@@ -264,7 +273,7 @@ function makeCorrectAnswer(question: Question): JSX.Element {
[
...accum,
...i > 0 ? [ or ] : [],
- {curr.p},
+ {curr.p} - {curr.f},
]
)), [] as JSX.Element[])}
@@ -289,22 +298,20 @@ function makeCorrectAnswer(question: Question): JSX.Element {
// }
-function humanReadableVerbTense(tense: T.VerbTense): string {
- return tense === "presentVerb"
+function levelToDescription(level: VerbGameLevel): string {
+ return level === "presentVerb"
? "present"
- : tense === "subjunctiveVerb"
+ : level === "subjunctiveVerb"
? "subjunctive"
- : tense === "imperfectiveFuture"
- ? "imperfective future"
- : tense === "perfectiveFuture"
- ? "perfective future"
- : tense === "perfectivePast"
- ? "simple past"
- : tense === "imperfectivePast"
- ? "continuous past"
- : tense === "habitualImperfectivePast"
- ? "habitual simple past"
- : "habitual continuous past";
+ : "imperfective future or perfective future"
+}
+
+function levelToTense(level: VerbGameLevel): T.VerbTense {
+ return level === "presentVerb"
+ ? level
+ : level === "subjunctiveVerb"
+ ? level
+ : randFromArray(["perfectiveFuture", "imperfectiveFuture"]);
}
function makeVPS({ verb, subject, object, tense }: {
diff --git a/yarn.lock b/yarn.lock
index 0f8b6d9..6b2ac60 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1803,10 +1803,10 @@
rambda "^6.7.0"
react-select "^5.2.2"
-"@lingdocs/pashto-inflector@^3.7.9":
- version "3.7.9"
- resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.7.9.tgz#a1dc7b6635d9415d8dddfee9a09bb5b95190d7f0"
- integrity sha512-2LKY5TRUs9h7nE9gQaUUiNV0eLOh5Tr4eJtYp2RGaxeMZhOZhVbbiXc+FV2BPe9bOEpYK3hy678RLBIx0C18nQ==
+"@lingdocs/pashto-inflector@^3.8.3":
+ version "3.8.3"
+ resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-3.8.3.tgz#c549a3f3d33efc3ab18fab79160b9db8558e4a10"
+ integrity sha512-gvvKiiIeBXVaua84Fj+F3F+ZgHWIMV393NgTX1Kt48bQWU+704igiClZmOu6p1lxWOsOwdVslER1rCoYhvnSbQ==
dependencies:
"@formkit/auto-animate" "^1.0.0-beta.1"
classnames "^2.2.6"