|
@@ -5,7 +5,7 @@ use evaluate::*;
|
|
use log::info;
|
|
use log::info;
|
|
use rand::prelude::*;
|
|
use rand::prelude::*;
|
|
use std::collections::HashMap;
|
|
use std::collections::HashMap;
|
|
-use hash::{CacheEntry, Cache};
|
|
|
|
|
|
+use hash::*;
|
|
|
|
|
|
enum MoveUndo {
|
|
enum MoveUndo {
|
|
Default {
|
|
Default {
|
|
@@ -78,10 +78,17 @@ pub fn search(game: &Game, sc: &mut SearchControl, hash: &mut Cache, depth: i32)
|
|
match he.entry_type {
|
|
match he.entry_type {
|
|
EntryType::Value => {
|
|
EntryType::Value => {
|
|
if he.depth >= depth {
|
|
if he.depth >= depth {
|
|
|
|
+ info!("table hit!");
|
|
valued_moves.push((mov, he.value));
|
|
valued_moves.push((mov, he.value));
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ EntryType::UpperBound => {
|
|
|
|
+ /*if he.depth >= depth {
|
|
|
|
+ if
|
|
|
|
+ }*/
|
|
|
|
+ },
|
|
|
|
+ _ => {}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -253,20 +260,18 @@ pub fn apply_move(game: &Game, mov: Move) -> Game {
|
|
new_game.castling_rights[if game.turn == BLACK { 3 } else { 1 }] = false;
|
|
new_game.castling_rights[if game.turn == BLACK { 3 } else { 1 }] = false;
|
|
}
|
|
}
|
|
|
|
|
|
- if pt == ROOK {
|
|
|
|
- // invalidate castling rights
|
|
|
|
- if mov.from == square_from_indices(7, 7) {
|
|
|
|
- new_game.castling_rights[0] = false;
|
|
|
|
- }
|
|
|
|
- else if mov.from == square_from_indices(0, 7) {
|
|
|
|
- new_game.castling_rights[1] = false;
|
|
|
|
- }
|
|
|
|
- else if mov.from == square_from_indices(7, 7) {
|
|
|
|
- new_game.castling_rights[2] = false;
|
|
|
|
- }
|
|
|
|
- else if mov.from == square_from_indices(7, 7) {
|
|
|
|
- new_game.castling_rights[3] = false;
|
|
|
|
- }
|
|
|
|
|
|
+ // invalidate castling rights
|
|
|
|
+ if mov.from == square_from_indices(7, 0) || mov.to == square_from_indices(7, 0) {
|
|
|
|
+ new_game.castling_rights[0] = false;
|
|
|
|
+ }
|
|
|
|
+ if mov.from == square_from_indices(0, 0) || mov.to == square_from_indices(0, 0) {
|
|
|
|
+ new_game.castling_rights[1] = false;
|
|
|
|
+ }
|
|
|
|
+ if mov.from == square_from_indices(7, 7) || mov.to == square_from_indices(7, 7) {
|
|
|
|
+ new_game.castling_rights[2] = false;
|
|
|
|
+ }
|
|
|
|
+ if mov.from == square_from_indices(0, 7) || mov.to == square_from_indices(0, 7) {
|
|
|
|
+ new_game.castling_rights[3] = false;
|
|
}
|
|
}
|
|
|
|
|
|
if from_square(mov.to) | others != 0 {
|
|
if from_square(mov.to) | others != 0 {
|