Reference · Gunjin Shogi club rules
gunjinCombatfunction
Resolves a club-rules Gunjin Shogi battle without mutating match state. A piece that attacks a flag takes it, and wins; a flag that attacks anything else is removed with it.
Import it
import { gunjinCombat } from "@johnmorrisdotca/gunjin/gunjin-shogi";
Definition
function gunjinCombat(attacker: string, defender: string): "attacker" | "defender" | "both"
Parameters
| Name | Type | Description |
|---|---|---|
attacker | string | The native role key of the attacking piece. |
defender | string | The native role key of the defending piece. |
Returns
"attacker" | "defender" | "both"
Resolves a club-rules Gunjin Shogi battle without mutating match state. A piece that attacks a flag takes it, and wins; a flag that attacks anything else is removed with it.
Examples
import { gunjinCombat } from "@johnmorrisdotca/gunjin/gunjin-shogi";
console.log(gunjinCombat("engineer","mine"));attackerWhat it prints (run when this page was built)