https://github.com/wandererxii/shogiops
Shogi rules and operations in TypeScript
https://github.com/wandererxii/shogiops
chushogi csa kif minishogi sfen shogi shogi-game typescript
Last synced: 3 months ago
JSON representation
Shogi rules and operations in TypeScript
- Host: GitHub
- URL: https://github.com/wandererxii/shogiops
- Owner: WandererXII
- License: gpl-3.0
- Created: 2021-01-17T17:57:41.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-12-25T15:14:36.000Z (over 1 year ago)
- Last Synced: 2025-03-16T00:35:04.778Z (over 1 year ago)
- Topics: chushogi, csa, kif, minishogi, sfen, shogi, shogi-game, typescript
- Language: TypeScript
- Homepage:
- Size: 1.44 MB
- Stars: 8
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# shogiops
[](https://lishogi.org)

[](https://www.npmjs.com/package/shogiops)
Shogi and operations in TypeScript forked from [chessops](https://github.com/niklasf/chessops), rewritten for shogi.
## Features
- Read and write SFEN
- Vocabulary (Square, SquareSet, Color, Role, Piece, Board, Position)
- Shogi
- Move/drop making
- Legal move and drop move generation
- Game end and outcome
- Setup validation
- Attacks and rays using hyperbola quintessence
- Read and write USI, Japanese, Western and Kitao-Kawasaki notation
- Read and write KIF and CSA notation
- Currently supported variants - shogi, minishogi, chushogi, annan shogi and kyoto shogi.
- [Compatibility with shogiground](https://github.com/WandererXII/shogiground)
- [Compatibility with lishogi](https://lishogi.org)
[File an issue](https://github.com/WandererXII/shogiops/issues/new) to request more or report a bug.
## Example
Test directory has a lot of examples and use-cases.
```typescript
import { initialSfen, parseSfen } from 'shogiops/sfen';
import type { Rules } from 'shogiops/types';
import { parseUsi } from 'shogiops/util';
const rules: Rules = 'standard';
const sfen = initialSfen(rules);
const pos = parseSfen(rules, sfen).unwrap(); // or handle errors
const usi = parseUsi('7g7f')!;
pos.play(usi);
```
## License
shogiops is licensed under the GNU General Public License 3 or any later
version at your choice. See LICENSE.txt for details.