### Shogi Library Usage Example
Source: https://docs.rs/crate/shogi/latest/source/README
Demonstrates how to use the shogi Rust crate to represent a Shogi position, set it from an SFEN string, make moves programmatically and from SFEN strings, and convert the position back to an SFEN string. It utilizes types like `Move` and `Position`, and constants from `shogi::square::consts`.
```Rust
use shogi::{Move, Position};
use shogi::bitboard::Factory as BBFactory;
use shogi::square::consts::*;
BBFactory::init();
let mut pos = Position::new();
// Position can be set from the SFEN formatted string.
pos.set_sfen("lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1").unwrap();
// You can programatically create a Move instance.
let m = Move::Normal{from: SQ_7G, to: SQ_7F, promote: false};
pos.make_move(m).unwrap();
// Move can be created from the SFEN formatted string as well.
let m = Move::from_sfen("7c7d").unwrap();
pos.make_move(m).unwrap();
// Position can be converted back to the SFEN formatted string.
assert_eq!("lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1 moves 7g7f 7c7d", pos.to_sfen());
```
--------------------------------
### Shogi Position and Move Handling in Rust
Source: https://docs.rs/crate/shogi/latest/index
This example demonstrates how to use the shogi-rs library to initialize a Shogi position, set it from an SFEN string, make moves programmatically and from SFEN strings, and convert the position back to SFEN format. It utilizes the `Position`, `Move`, `Factory`, and `Square` components of the library.
```Rust
use shogi::{Move, Position};
use shogi::bitboard::Factory as BBFactory;
use shogi::square::consts::*;
BBFactory::init();
let mut pos = Position::new();
// Position can be set from the SFEN formatted string.
pos.set_sfen("lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1").unwrap();
// You can programatically create a Move instance.
let m = Move::Normal{from: SQ_7G, to: SQ_7F, promote: false};
pos.make_move(m).unwrap();
// Move can be created from the SFEN formatted string as well.
let m = Move::from_sfen("7c7d").unwrap();
pos.make_move(m).unwrap();
// Position can be converted back to the SFEN formatted string.
assert_eq!("lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1 moves 7g7f 7c7d", pos.to_sfen());
```
--------------------------------
### Shogi Library Overview
Source: https://docs.rs/crate/shogi/latest/source/LICENSE
This snippet provides a high-level overview of the shogi Rust crate, detailing its purpose as a bitboard-based Shogi library. It covers board representation, move handling, and time control utilities.
```Rust
Bitboard based Shogi library. Board representation, move handlings and various time control utilities.
```
--------------------------------
### Cargo.toml Configuration for shogi Crate
Source: https://docs.rs/crate/shogi/latest/source/Cargo
This snippet shows the Cargo.toml file for the shogi crate, version 0.12.2. It includes package metadata, dependencies on bitintr, itertools, and thiserror, and profile configurations for testing and benchmarking.
```toml
[package]
name = "shogi"
version = "0.12.2"
authors = ["nozaq"]
description = "Bitboard based Shogi library. Board representation, move handlings and various time control utilities."
keywords = ["shogi", "move", "usi", "sfen"]
categories = ["game-engines"]
repository = "https://github.com/nozaq/shogi-rs"
documentation = "http://nozaq.github.io/shogi-rs"
readme = "README.md"
license = "MIT"
edition = "2021"
[dependencies]
bitintr = "0.3"
itertools = "0.10"
thiserror = "1.0"
[profile.test]
opt-level = 0
debug = true
lto = false
debug-assertions = true
codegen-units = 1
[profile.bench]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
```
--------------------------------
### Shogi Crate Version Information
Source: https://docs.rs/crate/shogi/latest/source/.cargo_vcs_info
Provides Git commit information for the shogi crate.
```JSON
{
"git": {
"sha1": "0bf4aed16ac0ffc0140336ae0f719b8f098f22ee"
},
"path_in_vcs": ""
}
```
--------------------------------
### MIT License
Source: https://docs.rs/crate/shogi/latest/source/LICENSE
This snippet contains the MIT License text, which governs the usage and distribution of the shogi software. It includes copyright information and terms of use.
```License
MIT License
Copyright (c) 2017 Takashi Nozawa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
--------------------------------
### Shogi Library Version 0.12.2
Source: https://docs.rs/crate/shogi/latest/source/CHANGELOG
This snippet represents the changelog for the shogi Rust crate, detailing updates and fixes across various versions. It includes chore updates, feature enhancements, bug fixes, and refactoring efforts.
```Rust
## [Unreleased]
## [0.12.2] - 2021-12-27
### Chore
- upgrade to 2021 edition ([#45](https://github.com/nozaq/shogi-rs/issues/45))
- upgrade checkout action to v2 ([#44](https://github.com/nozaq/shogi-rs/issues/44))
## [0.12.1] - 2021-12-09
### Fix
- Uchifuzume check ([#41](https://github.com/nozaq/shogi-rs/issues/41))
- typo and reference link ([#40](https://github.com/nozaq/shogi-rs/issues/40))
## [0.12.0] - 2021-11-14
### Feat
- make Position#find_king() public ([#39](https://github.com/nozaq/shogi-rs/issues/39))
## [0.11.0] - 2021-10-04
### Feat
- make Position#pinned_bb public ([#36](https://github.com/nozaq/shogi-rs/issues/36))
- modernize error types ([#35](https://github.com/nozaq/shogi-rs/issues/35))
## [0.10.3] - 2021-10-03
### Chore
- rename `master` branch to `main` ([#33](https://github.com/nozaq/shogi-rs/issues/33))
### Fix
- add inc_time before the turn begins ([#34](https://github.com/nozaq/shogi-rs/issues/34))
## [0.10.2] - 2021-08-15
## [0.10.1] - 2021-08-15
### Fix
- broken compilation in perft ([#31](https://github.com/nozaq/shogi-rs/issues/31))
## [0.10.0] - 2020-11-14
### Chore
- use tarpaulin to measure coverage
### Fix
- use range expressions
- clippy warnings
- rename an unused variable
- unmaking of capturing move ([#27](https://github.com/nozaq/shogi-rs/issues/27))
## [0.9.0] - 2019-12-30
### Chore
- delete unnecessary panic settings
- use Github Actions
### Refactor
- fix clippy warnings and errors
- use dyn for specifying trait objects
- use ? instead of r#try
## [0.8.0] - 2019-01-24
### Chore
- use git-chglog to generate CHANGELOG
- remove redundant builds
- add appveyor config
### Feat
- add Position#player_bb()
### Fix
- add Cargo.toml
- Coveralls integration
### Refactor
- migrate to 2018 edition
- upgrade itertools to v0.8.0
- upgrade bitintr to v0.2
## [0.7.0] - 2017-05-14
### Refactor
- extract 'usi' module as an external crate
## [0.6.0] - 2017-03-05
## [0.5.0] - 2017-02-25
### Feat
- ensure Square not to return invalid values ([#7](https://github.com/nozaq/shogi-rs/issues/7))
### Fix
- check pinning status in Uchifuzume detection ([#8](https://github.com/nozaq/shogi-rs/issues/8))
## [0.4.0] - 2017-02-22
### Feat
- add Nyugyoku check ([#6](https://github.com/nozaq/shogi-rs/issues/6))
## [0.3.0] - 2017-02-19
### Feat
- add a helper type to manage time controls ([#5](https://github.com/nozaq/shogi-rs/issues/5))
### Refactor
- remove an unused variable
## [0.2.0] - 2017-02-19
### Chore
- temporary workaround for coverall integration ([#3](https://github.com/nozaq/shogi-rs/issues/3))
### Feat
- USI protocol helpers ([#4](https://github.com/nozaq/shogi-rs/issues/4))
## 0.1.0 - 2017-02-18
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.