bitstackchess 0.1.1

A bitboard‐based chess game engine with 10 × u128 move history
Documentation
use chess_game::{ChessGame, Move10};

fn main() {
    println!("ChessGame prototype starting...");
    let mut game = ChessGame::new();
    println!("Starting position loaded. ply = 0");

    // ——— White’s kingside castling demo ———
    game.push_move(9, 22); // White knight g1→g3
    game.push_move(0, 40); // Black pawn a7→a6
    game.push_move(11, 12); // White bishop f1→e2
    game.push_move(0, 32); // Black pawn a6→a5

    println!(
        "Before castling: king at {:?}, rook at {:?}",
        game.mapping.piece_square[15], // e1=4
        game.mapping.piece_square[13], // h1=7
    );
    game.push_move(15, 6); // White king e1→g1 (castling)
    println!(
        "After White castling, ply = {}, king at {:?}, rook at {:?}",
        game.ply,
        game.mapping.piece_square[15], // g1=6
        game.mapping.piece_square[13], // f1=5
    );
    for _ in 0..5 {
        game.pop_move();
    }
    println!(
        "After undo all, king at {:?}, rook at {:?}",
        game.mapping.piece_square[15], // e1=4
        game.mapping.piece_square[13], // h1=7
    );

    // ——— Black’s kingside castling demo ———
    game.push_move(0, 16);  // White pawn a2→a3
    game.push_move(9, 55);  // Black knight g8→h6
    game.push_move(0, 24);  // White pawn a3→a4
    game.push_move(11, 54); // Black bishop f8→g7

    // Insert a dummy White move so that ply % 2 == 1 (Black’s turn):
    game.push_move(1, 17); // White pawn b2→b3

    println!(
        "Before Black castling: king at {:?}, rook at {:?}",
        game.mapping.piece_square[31], // e8=60
        game.mapping.piece_square[29], // h8=63
    );
    game.push_move(15, 62); // Black king e8→g8 (castling)
    println!(
        "After Black castling, ply = {}, king at {:?}, rook at {:?}",
        game.ply,
        game.mapping.piece_square[31], // g8=62
        game.mapping.piece_square[29], // f8=61
    );
    for _ in 0..6 {
        game.pop_move();
    }
    println!(
        "After undo all (Black), king at {:?}, rook at {:?}",
        game.mapping.piece_square[31], // e8=60
        game.mapping.piece_square[29], // h8=63
    );

    // ——— En passant demo ———
    game.push_move(4, 28); // White e2→e4
    println!("After White pawn double-step, EP target = {:?}", game.en_passant_target);
    game.push_move(0, 40); // Black pawn a7→a6
    game.push_move(4, 36); // White pawn e4→e5
    game.push_move(3, 35); // Black pawn d7→d5
    println!("After Black pawn double-step, EP target = {:?}", game.en_passant_target);
    game.push_move(4, 43); // White pawn e5→d6 en passant
    println!(
        "After EP capture, captured_bits = {:032b}, square 35 now occupied by {:?}",
        game.captured_bits,
        game.mapping.who_on_square(43) // d6=43
    );
}