Skip to content

Commit 029eaff

Browse files
committed
actual bugfix this time
1 parent 219475c commit 029eaff

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/algorithms/the_algorithm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,10 @@ impl Algorithm {
351351
//Essentially, gets the dot product between a "vector" of the bitboard (containing 64 0s and 1s) and the table with position bonus constants.
352352
let mut bonus: f32 = 0.;
353353
//Get's the bitboard with all piece positions, and runs bitwise and for the board having one's own colors.
354-
let mut piece_board: u64 = (piece_bitboard.reverse_colors().to_size(63) as u64) & (color_bitboard.reverse_colors().to_size(63) as u64);
354+
let mut piece_board: u64 = (piece_bitboard & color_bitboard).reverse_colors().to_size(0) as u64;
355355
for i in 0..63 {
356356
//I'm pretty sure the bitboard and position_table have opposite orientationns. Regardless, flipping the bitboard significantly increased performance.
357-
bonus += (piece_board >> 1 & 1) as f32 * position_table[i];
357+
bonus += (piece_board >> i & 1) as f32 * position_table[i];
358358
}
359359
return bonus;
360360
}

src/common/constants.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ pub(crate) const position_bonus_table_pawn: [f32; 64] = [
1515
1., 1., 1., 1., 1., 1., 1., 1.,
1616
0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
1717
0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
18-
0., 0., 0., 0., 0., 0., 0., 0.,
19-
0., 0., 0., 0., 0., 0., 0., 0.,
18+
0., 0.1, 0.1, 0.1, 0.1, 0.1, 0., 0.,
19+
0., 0., 0., 0.1, 0.1, 0., 0., 0.,
2020
0., 0., 0., 0., 0., 0., 0., 0.,
2121
0., 0., 0., 0., 0., 0., 0., 0.
2222
];

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ mod pitter;
1616
async fn main() {
1717
let modules1 = ALPHA_BETA | POSITION_BONUS;
1818
let modules2 = ALPHA_BETA;
19-
let time_per_move1 = Duration::from_micros(2000);
20-
let time_per_move2 = Duration::from_micros(2000);
19+
let time_per_move1 = Duration::from_micros(500);
20+
let time_per_move2 = Duration::from_micros(500);
2121

2222
let competition = Competition::new(
2323
Algorithm::new(modules1, time_per_move1),
@@ -27,6 +27,6 @@ async fn main() {
2727
// competition.analyze_algorithm_choices(|(game_info, _), _| {
2828
// game_info.outcome == GameOutcome::InconclusiveTooLong
2929
// });
30-
let results = competition.start_competition(500).await;
30+
let results = competition.start_competition(2000).await;
3131
dbg!(results);
3232
}

src/pitter/logic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ impl Competition {
240240
game_pair_info.1.outcome,
241241
);
242242

243-
println!("Game pair played. Outcome: {:?}", combined_outcome);
244-
println!("{}", utils::to_pgn(&game_pair_info.0.game.unwrap()));
243+
//println!("Game pair played. Outcome: {:?}", combined_outcome);
244+
//println!("{}", utils::to_pgn(&game_pair_info.0.game.unwrap()));
245245
results.lock().await.register_game_outcome(combined_outcome);
246246

247247
let mut locked_stats = sum_stats.lock().await;

0 commit comments

Comments
 (0)