[board] Add Position::color_to_move defaulting to White
This commit is contained in:
parent
1575c83d31
commit
d2d33a4915
1 changed files with 5 additions and 1 deletions
|
@ -4,13 +4,15 @@ mod pieces;
|
|||
|
||||
use self::pieces::Pieces;
|
||||
use crate::bitboard::BitBoard;
|
||||
use crate::piece::{Piece, PiecePlacementError};
|
||||
use crate::square::Square;
|
||||
use crate::piece::{Color, Piece, PiecePlacementError};
|
||||
use std::fmt;
|
||||
use std::fmt::Write;
|
||||
|
||||
#[derive(Clone, Eq, Hash, PartialEq)]
|
||||
pub struct Position {
|
||||
color_to_move: Color,
|
||||
|
||||
/// Composite bitboards for all the pieces of a particular color.
|
||||
pieces_per_color: [BitBoard; 2],
|
||||
|
||||
|
@ -21,6 +23,7 @@ pub struct Position {
|
|||
impl Position {
|
||||
fn empty() -> Position {
|
||||
Position {
|
||||
color_to_move: Color::White,
|
||||
pieces_per_color: [BitBoard::empty(), BitBoard::empty()],
|
||||
pieces_per_type: [
|
||||
[
|
||||
|
@ -64,6 +67,7 @@ impl Position {
|
|||
];
|
||||
|
||||
Position {
|
||||
color_to_move: Color::White,
|
||||
pieces_per_color: [
|
||||
white_pieces.iter().fold(BitBoard::empty(), |a, b| a | b),
|
||||
black_pieces.iter().fold(BitBoard::empty(), |a, b| a | b),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue