cleanup and fix warnings

This commit is contained in:
Simon Gardling 2025-03-11 09:46:19 -04:00
parent 69dc686d0a
commit 0c832b1c7b
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
4 changed files with 13 additions and 6 deletions

View File

@ -7,9 +7,7 @@ use crate::{
logic::{ChildrenEvalMethod, FutureMoveConfig}, logic::{ChildrenEvalMethod, FutureMoveConfig},
repr::{Board, Piece, Winner}, repr::{Board, Piece, Winner},
}; };
use indicatif::{ use indicatif::{ParallelProgressIterator, ProgressBar, ProgressDrawTarget, ProgressStyle};
ParallelProgressIterator, ProgressBar, ProgressDrawTarget, ProgressStyle, TermLike,
};
use rand::seq::SliceRandom; use rand::seq::SliceRandom;
use rayon::iter::{IntoParallelIterator, ParallelIterator}; use rayon::iter::{IntoParallelIterator, ParallelIterator};
use skillratings::{ use skillratings::{
@ -17,6 +15,7 @@ use skillratings::{
Outcomes, Rating, Outcomes, Rating,
}; };
#[allow(dead_code)]
pub fn run() { pub fn run() {
const FMV_BASE: FutureMoveConfig = FutureMoveConfig { const FMV_BASE: FutureMoveConfig = FutureMoveConfig {
max_depth: 20, max_depth: 20,

View File

@ -74,6 +74,7 @@ impl std::fmt::Display for FutureMoveConfig {
} }
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
#[allow(dead_code)]
pub enum ChildrenEvalMethod { pub enum ChildrenEvalMethod {
/// Best (by far) strat compared to Max or Min /// Best (by far) strat compared to Max or Min
Average, Average,
@ -168,6 +169,7 @@ impl FutureMoves {
} }
} }
#[allow(dead_code)]
fn remove(&mut self, index: usize) { fn remove(&mut self, index: usize) {
if let Some(parent) = self.arena[index].parent { if let Some(parent) = self.arena[index].parent {
self.arena[parent].children.retain(|&j| j != index); self.arena[parent].children.retain(|&j| j != index);
@ -410,6 +412,7 @@ impl FutureMoves {
/// Checks the consistancy of the Arena (parents and children) /// Checks the consistancy of the Arena (parents and children)
/// returns a vector of errors ([`String`]) /// returns a vector of errors ([`String`])
#[allow(dead_code)]
pub fn check_arena(&self) -> Vec<String> { pub fn check_arena(&self) -> Vec<String> {
let mut errors = vec![]; let mut errors = vec![];
for idx in 0..self.arena.len() { for idx in 0..self.arena.len() {

View File

@ -1,7 +1,11 @@
use super::{bitboard::BitBoard, piece::Piece, CoordAxis, CoordPair}; use super::{bitboard::BitBoard, piece::Piece, CoordAxis, CoordPair};
use arrayvec::ArrayVec; use arrayvec::ArrayVec;
use rand::seq::IteratorRandom; use rand::seq::IteratorRandom;
use std::{cmp::Ordering, fmt}; use std::{
cmp::Ordering,
fmt,
ops::{BitAndAssign, BitOrAssign},
};
/// Map of all points on the board against some type T /// Map of all points on the board against some type T
/// Used to index like so: example[i][j] /// Used to index like so: example[i][j]
@ -274,8 +278,8 @@ impl Board {
} }
fn apply_flip_mask(&mut self, color: Piece, flip_mask: BitBoard) { fn apply_flip_mask(&mut self, color: Piece, flip_mask: BitBoard) {
*get_board!(mut self, color) |= flip_mask; get_board!(mut self, color).bitor_assign(flip_mask);
*get_board!(mut self, color.flip()) &= !flip_mask; get_board!(mut self, color.flip()).bitand_assign(!flip_mask);
} }
/// Propegate piece captures originating from (i, j) /// Propegate piece captures originating from (i, j)

View File

@ -20,6 +20,7 @@ impl CoordPair {
Self(row * Board::BOARD_SIZE + col) Self(row * Board::BOARD_SIZE + col)
} }
#[allow(clippy::wrong_self_convention)]
fn into_indexes(&self) -> (CoordAxis, CoordAxis) { fn into_indexes(&self) -> (CoordAxis, CoordAxis) {
self.0.div_mod_floor(&Board::BOARD_SIZE) self.0.div_mod_floor(&Board::BOARD_SIZE)
} }