~bfiedler/rschess

2db92bfcb53e432ecdfc53b48eaece9c5d811180 — Ben Fiedler 1 year, 7 months ago fb57937
Rename verbose_perft -> divide
2 files changed, 5 insertions(+), 5 deletions(-)

M src/main.rs
M src/search.rs
M src/main.rs => src/main.rs +1 -1
@@ 60,7 60,7 @@ fn main() {
    }
    dbg!(p);
    let n = Node { pos: p };
    let (cnt, mvs) = n.verbose_perft(depth);
    let (cnt, mvs) = n.divide(depth);
    for mv in mvs {
        println!("{}", mv);
    }

M src/search.rs => src/search.rs +4 -4
@@ 3,12 3,12 @@ use crate::position::*;
use std::fmt;

#[derive(Copy, Clone)]
pub struct PerftMove {
pub struct DivideMove {
    mv: Move,
    cnt: u64,
}

impl fmt::Display for PerftMove {
impl fmt::Display for DivideMove {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{} {}", self.mv, self.cnt)
    }


@@ 36,7 36,7 @@ impl Node {
        cnt
    }

    pub fn verbose_perft(&self, depth: u32) -> (u64, Vec<PerftMove>) {
    pub fn divide(&self, depth: u32) -> (u64, Vec<DivideMove>) {
        let mut moves = Vec::with_capacity(INITIAL_MOVE_NUM);
        let mut cnt: u64 = 0;



@@ 45,7 45,7 @@ impl Node {
            copy.pos.make_move(mv);
            let num = copy.perft(depth - 1);
            cnt += num;
            moves.push(PerftMove { mv: mv, cnt: num })
            moves.push(DivideMove { mv: mv, cnt: num })
        }

        (cnt, moves)