1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
//! A library for implementing Shogi application. //! //! `shogi` provides a various types and implementations for representing concepts and rules in Shogi. //! Most types can be created programatically while they can also be deserialized from / serialized to SFEN format. //! `usi` module provides APIs to deal with USI commands in a type-safe way. //! See http://www.geocities.jp/shogidokoro/usi.html for more detail about UCI protocol specification and SFEN format. //! //! # Examples //! //! ``` //! use shogi::{Move, Position}; //! use shogi::square::consts::*; //! //! 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()); //! ``` #![recursion_limit="81"] #[macro_use()] extern crate itertools; pub mod color; pub mod error; pub mod hand; pub mod moves; pub mod piece_type; pub mod piece; pub mod position; pub mod square; pub mod time; pub mod usi; pub use self::color::Color; pub use self::error::{MoveError, SfenError}; pub use self::square::Square; pub use self::piece_type::PieceType; pub use self::piece::Piece; pub use self::moves::Move; pub use self::hand::Hand; pub use self::position::{MoveRecord, Position}; pub use self::time::TimeControl;