Currently, information about each piece and how they work are sprawled out across the codebase- typeutil, movesets, pieceThemes, specialdetect, specialmoves. Bringing all data about a single piece into one location would make them both easier to manage, and add new pieces. Take inspiration from how variants are data-driven within variant.ts. Since each piece needs considerably more data than a single variant, let's give each piece its own dedicated file, with one management file for storing the Type Definitions, and reading data from the piece entries.
Each piece needs to store (with their existing info location in parenthesis):
- Moves: individual, sliding, blocking function, ignore function, special detect function, special vicinity. (movesets.ts, specialdetect.ts)
- Special move function (specialmove.ts)
- 2 letter icn code (icnconverter.ts)
- svg location on the server, and color overrides (pieceThemes.ts)
- whether it is a royal
- whether it can castle with royals
- whether when moved it resets the 50 move rule.
Currently, information about each piece and how they work are sprawled out across the codebase- typeutil, movesets, pieceThemes, specialdetect, specialmoves. Bringing all data about a single piece into one location would make them both easier to manage, and add new pieces. Take inspiration from how variants are data-driven within
variant.ts. Since each piece needs considerably more data than a single variant, let's give each piece its own dedicated file, with one management file for storing the Type Definitions, and reading data from the piece entries.Each piece needs to store (with their existing info location in parenthesis):