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 {
color: Piece,

View File

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

View File

@ -2,8 +2,8 @@ use indicatif::{ProgressIterator, ProgressStyle};
use crate::{
board::{Board, Winner},
logic::r#move::Move,
piece::Piece,
r#move::Move,
};
pub struct FutureMoves {
@ -192,7 +192,7 @@ impl FutureMoves {
// TODO! impl dynamic sorting based on children's states, maybe it propegates
// upwards using the `parent` field
// 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
// negative because we want the largest value in the first index
.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 board;
mod complexagent;
pub mod future_moves;
mod game;
mod logic;
mod misc;
mod r#move;
mod piece;
fn main() {