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
71
72
73
74
75
76
77
78
79
80
81
#![feature(test)]
#![feature(platform_intrinsics)]
#![feature(const_fn)]
#![feature(binary_heap_into_iter_sorted)]
pub mod bb;
mod board;
mod cache;
mod castle;
mod castling_rights;
mod gen;
mod hash;
mod integrity;
mod mv;
mod mv_list;
mod perft;
mod piece;
mod position;
mod side;
mod square;
mod util;
#[cfg(target_feature = "sse3")]
mod dbb;
extern crate num_cpus;
extern crate rand;
extern crate threadpool;
#[cfg(test)]
extern crate test;
#[cfg(test)]
extern crate unindent;
pub use bb::BB;
pub use board::Board;
pub use castle::{Castle, KING_SIDE, QUEEN_SIDE};
pub use castling_rights::{CastlingRights, BLACK_KS, BLACK_QS, WHITE_KS, WHITE_QS};
pub use gen::{legal_moves, loud_legal_moves};
pub use mv::{Move, MoveScore, KING_SIDE_CASTLE, NULL_MOVE, QUEEN_SIDE_CASTLE};
pub use mv_list::{
BestMoveTracker, MoveCounter, MoveList, MoveVec, PieceSquareTable, ScoredMoveList,
SortedMoveList,
};
pub use perft::perft;
pub use perft::perft_detailed;
pub use piece::*;
pub use position::{Position, State, STARTING_POSITION_FEN};
pub use side::{Side, BLACK, WHITE};
pub use square::*;
#[cfg(target_feature = "sse3")]
pub use dbb::*;
#[test]
fn basic_functionality() {
let mut counter = MoveCounter::new();
let position = Position::from_fen(STARTING_POSITION_FEN).unwrap();
let in_check = legal_moves(&position, &mut counter);
assert!(!in_check);
assert_eq!(counter.moves, 20);
assert_eq!(counter.captures, 0);
assert_eq!(counter.castles, 0);
assert_eq!(counter.ep_captures, 0);
assert_eq!(counter.promotions, 0);
}