This commit is contained in:
Simon Gardling 2025-02-26 19:50:40 -05:00
parent cd0ac5f538
commit bbeb1b8b37
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
5 changed files with 12 additions and 13 deletions

View File

@ -11,7 +11,6 @@ path = "src/lib.rs"
name = "othello_game"
path = "src/main.rs"
[profile.release]
# increases perf at the cost of compile-time
codegen-units = 1 # ~4-5% perf bump
@ -22,7 +21,6 @@ inherits = "release"
# for profiling
debug = true
[features]
bitvec = [ "dep:bitvec" ]
@ -33,13 +31,13 @@ const_fn = "0.4"
either = "1.13"
indicatif = "0.17"
lazy_static = "1.5"
nohash-hasher = "0.2.0"
nohash-hasher = "0.2"
num = "0.4"
rand = "0.9"
static_assertions = "1.1"
[dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] }
criterion = { version = "0.5", features = [ "html_reports" ] }
[[bench]]
name = "future_children"

View File

@ -13,7 +13,7 @@ pub struct ComplexAgent {
impl ComplexAgent {
pub const fn new(color: Piece) -> Self {
const CONFIG: FutureMoveConfig = FutureMoveConfig {
max_depth: 9,
max_depth: 10,
start_pruning_at_minus: 4,
top_k_children: 2,
up_to_mod: 4,

View File

@ -263,14 +263,16 @@ impl FutureMoves {
/// Returns a boolean, `true` if the operation was successful, false if not
#[must_use = "You must check if the root was properly set"]
pub fn update_root_coord(&mut self, i: usize, j: usize) -> bool {
// check to make sure current_root is some so we dont
// have to do that in the iterator
if self.current_root.is_none() {
return false;
}
self.arena
.iter()
.enumerate()
.find(|(_, node)| {
node.parent == self.current_root
&& self.current_root.is_some()
&& node.coords() == (i, j)
})
.find(|(_, node)| node.parent == self.current_root && node.coords() == (i, j))
.map(|x| x.0)
// do raw set so we can prune it on the next move (in `update`)
.inspect(|&root| self.update_root_idx_raw(root))

View File

@ -54,7 +54,6 @@ impl Move {
self_value: 0,
};
m.self_value = m.compute_self_value(agent_color);
m.value = Some(m.self_value as i128);
m
}

View File

@ -10,8 +10,8 @@ pub mod repr;
fn main() {
let player1 = complexagent::ComplexAgent::new(Piece::Black);
// let player2 = complexagent::ComplexAgent::new(Piece::White);
// let player2 = agent::ManualAgent::new(Piece::White);
let player2 = agent::RandomAgent::new(Piece::White);
let player2 = agent::ManualAgent::new(Piece::White);
// let player2 = agent::RandomAgent::new(Piece::White);
let mut game = Game::new(Box::new(player1), Box::new(player2));
game.game_loop();
}