Skip to content

Commit

Permalink
add goerlit kyu2 and 1
Browse files Browse the repository at this point in the history
  • Loading branch information
nknapp committed Sep 3, 2024
1 parent 079016f commit 9802458
Show file tree
Hide file tree
Showing 4 changed files with 323 additions and 3 deletions.
166 changes: 164 additions & 2 deletions src/data/dojos/goerlitz/exams/kyu1.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,173 @@
import type { Exam } from "$core/model";
import type { Directions, Exam, TechniqueMetadata } from "$core/model";
import { goerlitzTree } from "@/data/dojos/goerlitz/exams/utils/goerlitzTree.ts";

function pinAttacksTachiWaza(directions: Directions<TechniqueMetadata>) {
return {
"ai hanmi katate dori": directions,
"shomen uchi": directions,
"gyuako hanmi katate dori": directions,
"ryote dori": directions,
"kata dori": directions,
"yokomen uchi": directions,
"ushiro ryote dori": directions,
"katate ryote dori": directions,
"kata dori men uchi": directions,
"ushiro ryo kata dori": directions,
"mae ryo kata dori": directions,
"jodan tsuki": directions,
"chudan tsuki": directions,
"ushiro ryo hiji dori": directions,
"ushiro eri dori": directions,
"ushiro katate dori kubi shime": directions,
};
}
export const kyu1: Exam = {
id: "kyu1",
label: {
type: "wellknown",
key: "kyu1",
},

techniques: {},
techniques: goerlitzTree({
"suwari waza": {
ikkyo: {
"ai hanmi katate dori": { omote: {}, ura: {} },
"kata dori": { omote: {}, ura: {} },
"shomen uchi": { omote: {}, ura: {} },
"gyuako hanmi katate dori": { omote: {}, ura: {} },
"yokomen uchi": { omote: {}, ura: {} },
"mae ryo kata dori": { omote: {}, ura: {} },
},
nikyo: {
"ai hanmi katate dori": { omote: {}, ura: {} },
"kata dori": { omote: {}, ura: {} },
"shomen uchi": { omote: {}, ura: {} },
"gyuako hanmi katate dori": { omote: {}, ura: {} },
"yokomen uchi": { omote: {}, ura: {} },
"mae ryo kata dori": { omote: {}, ura: {} },
},
sankyo: {
"ai hanmi katate dori": { omote: {}, ura: {} },
"kata dori": { omote: {}, ura: {} },
"shomen uchi": { omote: {}, ura: {} },
"gyuako hanmi katate dori": { omote: {}, ura: {} },
"yokomen uchi": { omote: {}, ura: {} },
"mae ryo kata dori": { omote: {}, ura: {} },
},
yonkyo: {
"ai hanmi katate dori": { omote: {}, ura: {} },
"kata dori": { omote: {}, ura: {} },
"shomen uchi": { omote: {}, ura: {} },
"gyuako hanmi katate dori": { omote: {}, ura: {} },
"yokomen uchi": { omote: {}, ura: {} },
"mae ryo kata dori": { omote: {}, ura: {} },
},
gokyo: {
"yokomen uchi": { "single-direction": {} },
},
"kote gaeshi": {
"yokomen uchi": { "single-direction": {} },
},
"irimi nage": {
"kata dori": { "single-direction": {} },
"kata dori men uchi": { "single-direction": {} },
},
},
"hanmi handachi waza": {
ikkyo: {
"gyuako hanmi katate dori": { omote: {}, ura: {} },
"ryote dori": { omote: {}, ura: {} },
"shomen uchi": { omote: {}, ura: {} },
"yokomen uchi": { omote: {}, ura: {} },
"ushiro ryo kata dori": { omote: {}, ura: {} },
},
"irimi nage": {
"yokomen uchi": { "single-direction": {} },
},
"kote gaeshi": {
"gyuako hanmi katate dori": { "single-direction": {} },
"yokomen uchi": { "single-direction": {} },
},
"shiho nage": {
"yokomen uchi": { omote: {}, ura: {} },
},
"kokyu nage": {
"gyuako hanmi katate dori": { "single-direction": {} },
"ryote dori": { "single-direction": {} },
"ushiro ryo kata dori": { "single-direction": {} },
},
// "kaiten nage": {...}
},
"tachi waza": {
ikkyo: pinAttacksTachiWaza({ omote: {}, ura: {} }),
nikyo: pinAttacksTachiWaza({ omote: {}, ura: {} }),
sankyo: pinAttacksTachiWaza({ omote: {}, ura: {} }),
yonkyo: pinAttacksTachiWaza({ omote: {}, ura: {} }),
"hiji kimo osae": pinAttacksTachiWaza({ "single-direction": {} }),
"ude garami": pinAttacksTachiWaza({ "single-direction": {} }),
gokyo: { "shomen uchi": { "single-direction": {} } },
"shiho nage": {
"muna dori": { "single-direction": {} },
"chudan tsuki": { omote: {}, ura: {} },
"jodan tsuki": { omote: {}, ura: {} },
"ushiro katate dori kubi shime": { "single-direction": {} },
"ushiro eri dori": { "single-direction": {} },
},
"irimi nage": {
"jodan tsuki": { "single-direction": {} },
"ushiro eri dori": { "single-direction": {} },
},
"sokumen irimi nage": {
"shomen uchi": { "single-direction": {} },
"chudan tsuki": { "single-direction": {} },
},
"soto kaiten nage": {
"jodan tsuki": { omote: {}, ura: {} },
},
"uchi kaiten nage": {
"chudan tsuki": { omote: {}, ura: {} },
"jodan tsuki": { omote: {}, ura: {} },
},
"ude kime nage": {
"chudan tsuki": { omote: {}, ura: {} },
"jodan tsuki": { omote: {}, ura: {} },
},
"sumi otoshi": {
"kata dori": { "single-direction": {} },
"mae ryo kata dori": { "single-direction": {} },
"shomen uchi": { "single-direction": {} },
},
"juji garami": {
"katate ryote dori": { "single-direction": {} },
},
"aiki otoshi": {
"shomen uchi": { "single-direction": {} },
"ushiro ryote dori": { "single-direction": {} },
},
"koshi nage": {
"ai hanmi katate dori": { "single-direction": {} },
"shomen uchi": { "single-direction": {} },
"gyuako hanmi katate dori": { "single-direction": {} },
"ryote dori": { "single-direction": {} },
"yokomen uchi": { "single-direction": {} },
"ushiro ryote dori": { "single-direction": {} },
},
"kokyu nage": {
"ai hanmi katate dori": { "single-direction": {} },
"shomen uchi": { "single-direction": {} },
"gyuako hanmi katate dori": { "single-direction": {} },
"ryote dori": { "single-direction": {} },
"kata dori": { "single-direction": {} },
"yokomen uchi": { "single-direction": {} },
"ushiro ryote dori": { "single-direction": {} },
"katate ryote dori": { "single-direction": {} },
"kata dori men uchi": { "single-direction": {} },
"ushiro ryo kata dori": { "single-direction": {} },
"mae ryo kata dori": { "single-direction": {} },
"jodan tsuki": { "single-direction": {} },
"chudan tsuki": { "single-direction": {} },
},
// "aiki nage": { shomen uchi: { "single-direction: {}} },
},
}),
};
107 changes: 106 additions & 1 deletion src/data/dojos/goerlitz/exams/kyu2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Exam } from "$core/model";
import { goerlitzTree } from "@/data/dojos/goerlitz/exams/utils/goerlitzTree.ts";

export const kyu2: Exam = {
id: "kyu2",
Expand All @@ -7,5 +8,109 @@ export const kyu2: Exam = {
key: "kyu2",
},

techniques: {},
techniques: goerlitzTree({
"suwari waza": {
ikkyo: {
"yokomen uchi": { omote: {}, ura: {} },
"mae ryo kata dori": { omote: {}, ura: {} },
},
nikyo: {
"yokomen uchi": { omote: {}, ura: {} },
"mae ryo kata dori": { omote: {}, ura: {} },
},
sankyo: {
"yokomen uchi": { omote: {}, ura: {} },
"mae ryo kata dori": { omote: {}, ura: {} },
},
yonkyo: {
"yokomen uchi": { omote: {}, ura: {} },
"mae ryo kata dori": { omote: {}, ura: {} },
},
gokyo: {
"shomen uchi": { "single-direction": {} },
},
"irimi nage": {
"gyuako hanmi katate dori": { "single-direction": {} },
},
"kote gaeshi": {
"gyuako hanmi katate dori": { "single-direction": {} },
"kata dori": { "single-direction": {} },
},
},
"hanmi handachi waza": {
"shiho nage": {
"ryote dori": { "single-direction": {} },
},
"uchi kaiten nage": {
"gyuako hanmi katate dori": { omote: {}, ura: {} },
},
"soto kaiten nage": {
"gyuako hanmi katate dori": { omote: {}, ura: {} },
},
"kote gaeshi": {
"shomen uchi": { "single-direction": {} },
},
"irimi nage": {
"shomen uchi": { "single-direction": {} },
},
},
"tachi waza": {
ikkyo: {
"katate ryote dori": { omote: {}, ura: {} },
"kata dori men uchi": { omote: {}, ura: {} },
"ushiro ryo kata dori": { omote: {}, ura: {} },
"chudan tsuki": { omote: {}, ura: {} },
},
nikyo: {
"katate ryote dori": { omote: {}, ura: {} },
"kata dori men uchi": { omote: {}, ura: {} },
"ushiro ryo kata dori": { omote: {}, ura: {} },
"chudan tsuki": { omote: {}, ura: {} },
},
"hiji kimo osae": {
"shomen uchi": { "single-direction": {} },
},
sankyo: {
"gyuako hanmi katate dori": { omote: {}, ura: {} },
"kata dori": { omote: {}, ura: {} },
"yokomen uchi": { omote: {}, ura: {} },
},
yonkyo: {
"ai hanmi katate dori": { omote: {}, ura: {} },
"yokomen uchi": { omote: {}, ura: {} },
},
gokyo: {
"yokomen uchi": { "single-direction": {} },
},
"shiho nage": {
"kata dori men uchi": { "single-direction": {} },
"shomen uchi": { "single-direction": {} },
},
"kote gaeshi": {
"kata dori men uchi": { "single-direction": {} },
"ryote dori": { "single-direction": {} },
"chudan tsuki": { "single-direction": {} },
},
"irimi nage": {
"kata dori men uchi": { "single-direction": {} },
"ryote dori": { "single-direction": {} },
"katate ryote dori": { "single-direction": {} },
"chudan tsuki": { "single-direction": {} },
},
"ude kime nage": {
"shomen uchi": { omote: {}, ura: {} },
},
"uchi kaiten nage": { "shomen uchi": { omote: {}, ura: {} } },
"soto kaiten nage": { "chudan tsuki": { omote: {}, ura: {} } },
"sokumen irimi nage": { "ushiro ryote dori": { omote: {}, ura: {} } },
"sumi otoshi": { "gyuako hanmi katate dori": { "single-direction": {} } },
"juji garami": { "ushiro ryote dori": { "single-direction": {} } },
"koshi nage": { "kata dori": { "single-direction": {} } },
"kokyu nage": {
"ryote dori": { "single-direction": {} },
"shomen uchi": { "single-direction": {} },
"yokomen uchi": { "single-direction": {} },
},
},
}),
};
29 changes: 29 additions & 0 deletions src/data/dojos/goerlitz/exams/utils/goerlitzTree.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { goerlitzTree } from "./goerlitzTree.ts";

describe("goerlitzTree", () => {
it("replaces attack and defence", () => {
expect(
goerlitzTree({
"suwari waza": {
sankyo: {
"jodan tsuki": { ura: {} },
},
nikyo: {
"jodan tsuki": { ura: {} },
},
},
}),
).toEqual({
"suwari waza": {
"jodan tsuki": {
nikyo: {
ura: {},
},
sankyo: {
ura: {},
},
},
},
});
});
});
24 changes: 24 additions & 0 deletions src/data/dojos/goerlitz/exams/utils/goerlitzTree.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Attack, Defence, Direction, Execution, Technique, TechniqueMetadata, TechniqueTree } from "$core/model";
import { buildExamTable } from "$core/buildExamTable";

export type GorTechniqueTree<T> = Partial<
Record<Execution, Partial<Record<Defence, Partial<Record<Attack, Partial<Record<Direction, T>>>>>>>
>;

export function goerlitzTree(tree: GorTechniqueTree<Record<never, unknown>>): TechniqueTree<Record<never, unknown>> {
return buildExamTable(resolveGorTechniqueTree(tree));
}

export function* resolveGorTechniqueTree(tree: GorTechniqueTree<TechniqueMetadata>): Generator<Technique> {
for (const [execution, defences] of entries(tree)) {
for (const [defence, attacks] of entries(defences)) {
for (const [attack, directions] of entries(attacks)) {
for (const [direction, metadata] of entries(directions)) {
yield { execution, attack, defence, direction, metadata };
}
}
}
}
}

const entries = Object.entries as <K extends string, V>(object: Partial<Record<K, V>>) => [K, V][];

0 comments on commit 9802458

Please sign in to comment.