|
@@ -59,7 +59,7 @@ pub fn search(game: &mut Game, sc: &mut SearchControl, hash: &mut Cache, mut alp
|
|
|
|
|
|
// use a slight offset for the alpha value in the root node in order to
|
|
|
// determine possibly multiple good moves
|
|
|
- const ALPHA_OFFSET: PosValue = 50 as PosValue;
|
|
|
+ const ALPHA_OFFSET: PosValue = 0 as PosValue;
|
|
|
|
|
|
let mut valued_moves: Vec<(Move, PosValue)> = Vec::with_capacity(moves.len());
|
|
|
let mut cancelled = false;
|
|
@@ -81,24 +81,23 @@ pub fn search(game: &mut Game, sc: &mut SearchControl, hash: &mut Cache, mut alp
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- /*if val >= mate_in_p1(1) {
|
|
|
+ if val >= mate_in_p1(1) {
|
|
|
// mate in 1 --- can't get better than that
|
|
|
info!("yay mate!");
|
|
|
return SearchResult::Finished(mov, increase_mate_in(val));
|
|
|
- }*/
|
|
|
+ }
|
|
|
|
|
|
//info!("searched {} -> {}", mov.to_string(), val);
|
|
|
|
|
|
if val > alpha {
|
|
|
alpha = val - ALPHA_OFFSET;
|
|
|
+ valued_moves.push((mov, -val));
|
|
|
}
|
|
|
-
|
|
|
- valued_moves.push((mov, -val));
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- info!("movvalues: {:?}", valued_moves.iter().map(|mv| mv.0.to_string() + " - " + &mv.1.to_string()).collect::<Vec<String>>());
|
|
|
+ //info!("movvalues: {:?}", valued_moves.iter().map(|mv| mv.0.to_string() + " - " + &mv.1.to_string()).collect::<Vec<String>>());
|
|
|
|
|
|
valued_moves.sort_by_key(|mv| mv.1);
|
|
|
|
|
@@ -134,19 +133,19 @@ fn negamax(game: &mut Game, sc: &mut SearchControl, hash: &mut Cache, mut alpha:
|
|
|
//EntryType::Value => { if e.value >= alpha { return (e.value, false); } else { return (alpha, false); } },
|
|
|
//EntryType::LowerBound => { if e.value > alpha { return (e.value, false) } },
|
|
|
EntryType::LowerBound => {
|
|
|
- if e.value < alpha { return (alpha, false); }
|
|
|
+ if e.value >= beta { return (beta, false); }
|
|
|
//if e.value >= beta { return (beta, false); }
|
|
|
},
|
|
|
//EntryType::UpperBound => { if e.value >= beta { return (beta, false); } },
|
|
|
EntryType::UpperBound => {
|
|
|
- if e.value >= beta { return (beta, false); }
|
|
|
+ if e.value < alpha { return (alpha, false); }
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if depth == 0 {
|
|
|
- return quiescence_search(game, sc, hash, alpha, beta, 13);
|
|
|
+ return quiescence_search(game, sc, hash, alpha, beta, 9);
|
|
|
}
|
|
|
|
|
|
sc.nodes += 1;
|