3 stable releases
2.0.0 | Jul 11, 2020 |
---|---|
1.0.1 | Jun 25, 2020 |
1.0.0 | Jun 16, 2020 |
#1496 in Game dev
1MB
1.5K
SLoC
shogai
a rust interface for shogi engines (with simple shogi engine capabilities)
Should be used as a library, but the demo (code in main.rs) is playable, as you can see below (me vs a stupid bot)
What it is
an helper programm that can create, manage, display (on terminal), and modify a shogiban (the board of shogi)
What it means: You can create a board, ask for possible (legal) moves, play such a move, print a board on the CLI, get things like the value (good position?) and nice things.
Who it is for
Honestly, I don't really know. Do you want to implement a shogi engine? Maybe that's the right place... I mean, you can do a shogi engine in a few lines (see ai::greedy) with the help of shogai, but as long as performance is a concern, I cannot offer any garanties. It is still quite optimized, but code clarity was more important than pure speed here.
DISCLAIMER: I do not have a way to compare performance with other shogi engines, as implementing a shogi engine is a completely different story, tons of if/elses branches etc...
If you are interested in building your own "high-perf" shogi engine in rust, you can use this helper to fasten development. You may have to redo some parts yourself if performance is not up to your expectations. Advantages of using shogai ?:
- CLI interface? Done
- move-checking (in case you are not 100% sure of yours)? Done
- Simple structure for pieces, position, movements with parsing? Done
Draw conditions are not managed.
Installation
add
shogai="*"
to your Cargo.toml
How to make it work
(or whatever it means for you) Depending on your goals, (i mean: performance goals), your usage can conform to examples as shown in documentation, or get quite optimized, but then, more complex.
The structure of your basic shogi program should look like this:
- create a Board
- loop
-
- read, get, generate ... a move ( as &str)
-
- play the move
-
- check if the game is over
Contributing
PR can be accepted, and contributors are welcome!