Skip to content

Commit

Permalink
📦 NEW: Include best move in data gen
Browse files Browse the repository at this point in the history
  • Loading branch information
ianagbip1oti committed Jan 28, 2024
1 parent fcc75dc commit 48f5734
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/bin/train-value.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use princhess::train::{ValueNetwork, TrainingPosition};
use princhess::train::{TrainingPosition, ValueNetwork};

use goober::{FeedForwardNetwork, OutputLayer, Vector};
use std::env;
Expand Down
9 changes: 7 additions & 2 deletions src/train/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ pub struct TrainingPosition {
occupied: Bitboard,
pieces: [u8; 16],
stm: Color,
result: i8,

#[allow(dead_code)]
result: i8,
evaluation: i32,

previous_moves: [Move; 4],

#[allow(dead_code)]
best_move: Move,

#[allow(dead_code)]
legal_moves: [Move; TrainingPosition::MAX_MOVES],

Expand Down Expand Up @@ -131,6 +133,8 @@ impl From<&SearchTree> for TrainingPosition {
v => pv.sum_rewards() / i64::from(v),
} as i32;

let best_move = *pv.get_move();

// white relative evaluation
evaluation = stm
.fold(evaluation, -evaluation)
Expand All @@ -147,6 +151,7 @@ impl From<&SearchTree> for TrainingPosition {
result,
evaluation,
previous_moves,
best_move,
legal_moves,
visits,
}
Expand Down

0 comments on commit 48f5734

Please sign in to comment.