split off logic

This commit is contained in:
Simon Gardling 2025-02-20 16:00:01 -05:00
parent 47faa2af75
commit 73faf4c1fb
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
6 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
use crate::{agent::Agent, board::Board, future_moves::FutureMoves, piece::Piece}; use crate::{agent::Agent, board::Board, logic::future_moves::FutureMoves, piece::Piece};
pub struct ComplexAgent { pub struct ComplexAgent {
color: Piece, color: Piece,

View File

@ -2,8 +2,7 @@ mod agent;
mod bitboard; mod bitboard;
pub mod board; pub mod board;
mod complexagent; mod complexagent;
pub mod future_moves;
mod game; mod game;
pub mod logic;
mod misc; mod misc;
mod r#move;
pub mod piece; pub mod piece;

View File

@ -2,8 +2,8 @@ use indicatif::{ProgressIterator, ProgressStyle};
use crate::{ use crate::{
board::{Board, Winner}, board::{Board, Winner},
logic::r#move::Move,
piece::Piece, piece::Piece,
r#move::Move,
}; };
pub struct FutureMoves { pub struct FutureMoves {
@ -192,7 +192,7 @@ impl FutureMoves {
// TODO! impl dynamic sorting based on children's states, maybe it propegates // TODO! impl dynamic sorting based on children's states, maybe it propegates
// upwards using the `parent` field // upwards using the `parent` field
// SAFETY! the sort_by_key function should not modify anything // SAFETY! the sort_by_key function should not modify anything
unsafe { (&mut *(self as *mut Self)).arena.get_unchecked_mut(idx) } unsafe { (*(self as *mut Self)).arena.get_unchecked_mut(idx) }
.children .children
// negative because we want the largest value in the first index // negative because we want the largest value in the first index
.sort_by_key(|&x| -self.arena[x].value); .sort_by_key(|&x| -self.arena[x].value);

2
src/logic/mod.rs Normal file
View File

@ -0,0 +1,2 @@
pub mod future_moves;
mod r#move;

View File

@ -5,10 +5,9 @@ mod agent;
mod bitboard; mod bitboard;
mod board; mod board;
mod complexagent; mod complexagent;
pub mod future_moves;
mod game; mod game;
mod logic;
mod misc; mod misc;
mod r#move;
mod piece; mod piece;
fn main() { fn main() {