split off logic
This commit is contained in:
parent
47faa2af75
commit
73faf4c1fb
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
2
src/logic/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod future_moves;
|
||||
mod r#move;
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user