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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#![doc(html_root_url = "https://jordanbray.github.io/chess/")]
//! # Rust Chess Library
//! This is a chess move generation library for rust.  It is designed to be fast, so that it can be
//! used in a chess engine or UI without performance issues.
//!
//! ## Example
//!
//! This generates all the moves on the starting chess position, and checks that the number of
//! moves is correct.
//!
//! ```
//!
//! use chess::{Board, MoveGen};
//!
//! let board = Board::default();
//! let movegen = MoveGen::new_legal(&board);
//! assert_eq!(movegen.len(), 20);
//! ```
//!

mod board;
pub use crate::board::*;

mod bitboard;
pub use crate::bitboard::{BitBoard, EMPTY};

mod cache_table;
pub use crate::cache_table::*;

mod castle_rights;
pub use crate::castle_rights::*;

mod chess_move;
pub use crate::chess_move::*;

mod color;
pub use crate::color::*;

mod construct;
pub use crate::construct::*;

mod file;
pub use crate::file::*;

mod magic;
pub use crate::magic::{
    between, get_adjacent_files, get_bishop_moves, get_bishop_rays, get_file, get_king_moves,
    get_knight_moves, get_pawn_attacks, get_pawn_moves, get_pawn_quiets, get_rank, get_rook_moves,
    get_rook_rays, line, EDGES,
};

#[cfg(target_feature = "bmi2")]
pub use crate::magic::{get_bishop_moves_bmi, get_rook_moves_bmi};

mod piece;
pub use crate::piece::*;

mod rank;
pub use crate::rank::*;

mod square;
pub use crate::square::*;

mod movegen;
pub use crate::movegen::MoveGen;

mod zobrist;

mod game;
pub use crate::game::{Action, Game, GameResult};