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 {
|
pub struct ComplexAgent {
|
||||||
color: Piece,
|
color: Piece,
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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
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 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() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user