Skip to content

Commit f9543ac

Browse files
committed
QOL: Print Game toggle
1 parent 1f4f5cd commit f9543ac

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

src/algorithms/the_algorithm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl Algorithm {
284284
}
285285
incremental_psqt_eval += incremental_psqt_eval_change * multiplier as f32;
286286
}
287-
best_evaluation.white_incremental_psqt_eval = Some(incremental_psqt_eval);
287+
best_evaluation.incremental_psqt_eval = Some(incremental_psqt_eval);
288288
}
289289

290290
if module_enabled(self.modules, TRANSPOSITION_TABLE) && depth >= 3 {

src/algorithms/utils.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ pub(super) struct Evaluation {
2222
pub(super) debug_data: Option<Vec<String>>,
2323
pub(super) eval: Option<f32>,
2424
pub(super) next_action: Option<Action>,
25-
pub(super) white_incremental_psqt_eval: Option<f32>,
25+
pub(super) incremental_psqt_eval: Option<f32>,
2626
}
2727

2828
impl Evaluation {
2929
pub(super) fn new(
3030
eval: Option<f32>,
3131
next_action: Option<Action>,
3232
debug_data: Option<Vec<String>>,
33-
white_incremental_psqt_eval: Option<f32>,
33+
incremental_psqt_eval: Option<f32>,
3434
) -> Evaluation {
3535
Evaluation {
3636
eval,
3737
next_action,
3838
debug_data,
39-
white_incremental_psqt_eval,
39+
incremental_psqt_eval,
4040
}
4141
}
4242
}

src/main.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ mod algorithms;
1414
mod common;
1515
mod pitter;
1616

17+
//If we should print the moves played and results of each game.
18+
pub(crate) const PRINT_GAME: bool = true;
19+
1720
#[tokio::main]
1821
async fn main() {
1922
//ALPHA_BETA | ANALYZE | SEARCH_EXTENSIONS | SKIP_BAD_MOVES | SQUARE_CONTROL_METRIC | TRANSPOSITION_TABLE | NAIVE_PSQT | PAWN_STRUCTURE | TAPERED_EVERY_PRESTO_PSQT | TAPERED_INCREMENTAL_PESTO_PSQT
20-
let modules1 = ALPHA_BETA | TAPERED_EVERY_PESTO_PSQT;
21-
let modules2 = ALPHA_BETA | NAIVE_PSQT;
23+
//Put 0 for no modules.
24+
let modules1 = ALPHA_BETA | TAPERED_INCREMENTAL_PESTO_PSQT;
25+
let modules2 = 0;
2226
let time_per_move1 = Duration::from_micros(2000);
2327
let time_per_move2 = Duration::from_micros(2000);
2428

@@ -30,6 +34,6 @@ async fn main() {
3034
// competition.analyze_algorithm_choices(|(game_info, _), _| {
3135
// game_info.outcome == GameOutcome::InconclusiveTooLong
3236
// });
33-
let results = competition.start_competition(50).await;
37+
let results = competition.start_competition(200).await;
3438
dbg!(results);
3539
}

src/pitter/logic.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use tokio::sync::Mutex;
88
use crate::algorithms::the_algorithm::Algorithm;
99
use crate::common::constants::modules::ANALYZE;
1010
use crate::common::utils::{self, Stats};
11+
use crate::PRINT_GAME;
1112

1213
pub(crate) struct Competition {
1314
pub(crate) algo1: Algorithm,
@@ -241,8 +242,10 @@ impl Competition {
241242
);
242243

243244
//Whether the game just played should be printed in console.
244-
//println!("Game pair played. Outcome: {:?}", combined_outcome);
245-
//println!("{}", utils::to_pgn(&game_pair_info.0.game.unwrap()));
245+
if PRINT_GAME == true {
246+
println!("Game pair played. Outcome: {:?}", combined_outcome);
247+
println!("{}", utils::to_pgn(&game_pair_info.0.game.unwrap()));
248+
}
246249

247250
results.lock().await.register_game_outcome(combined_outcome);
248251

0 commit comments

Comments
 (0)