-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
323 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {}} }, | ||
}, | ||
}), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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][]; |