Fix sigkill 9 running out of memory issue

This commit is contained in:
stefiosif
2024-09-15 20:27:48 +03:00
parent f128b35252
commit 3739e6e169
2 changed files with 3 additions and 12 deletions

View File

@@ -10,16 +10,15 @@ pub fn driver(game: &mut Game, nodes: &mut u64, depth: u8) {
let pseudo_moves = game.board.pseudo_moves_all();
for mv in pseudo_moves {
let original_board = game.board.clone();
game.make_move(&mv);
if game.board.king_under_check(color) {
game.board = original_board;
game.unmake_move();
continue;
}
driver(game, nodes, depth - 1);
game.board = original_board;
game.unmake_move();
}
}
@@ -74,7 +73,6 @@ mod tests {
fn perft(fen: &str, depth: u8) -> Result<u64, String> {
init_attacks();
let mut game = from_fen(fen)?;
let mut nodes = 0;
driver(&mut game, &mut nodes, depth);
@@ -85,7 +83,6 @@ mod tests {
#[test]
fn test_perft_1() -> Result<(), String> {
init_attacks();
assert_eq!(perft(FEN_PERFT[0], 5)?, 4865609);
Ok(())
@@ -94,7 +91,6 @@ mod tests {
#[test]
fn test_perft_2() -> Result<(), String> {
init_attacks();
assert_eq!(perft(FEN_PERFT[1], 5)?, 193690690);
Ok(())
@@ -103,7 +99,6 @@ mod tests {
#[test]
fn test_perft_3() -> Result<(), String> {
init_attacks();
assert_eq!(perft(FEN_PERFT[2], 5)?, 674624);
Ok(())
@@ -112,7 +107,6 @@ mod tests {
#[test]
fn test_perft_4() -> Result<(), String> {
init_attacks();
assert_eq!(perft(FEN_PERFT[3], 5)?, 15833292);
Ok(())
@@ -121,7 +115,6 @@ mod tests {
#[test]
fn test_perft_5() -> Result<(), String> {
init_attacks();
assert_eq!(perft(FEN_PERFT[4], 5)?, 89941194);
Ok(())
@@ -130,7 +123,6 @@ mod tests {
#[test]
fn test_perft_6() -> Result<(), String> {
init_attacks();
assert_eq!(perft(FEN_PERFT[5], 5)?, 164075551);
Ok(())