aa
This commit is contained in:
parent
cd0ac5f538
commit
bbeb1b8b37
@ -11,7 +11,6 @@ path = "src/lib.rs"
|
|||||||
name = "othello_game"
|
name = "othello_game"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
# increases perf at the cost of compile-time
|
# increases perf at the cost of compile-time
|
||||||
codegen-units = 1 # ~4-5% perf bump
|
codegen-units = 1 # ~4-5% perf bump
|
||||||
@ -22,7 +21,6 @@ inherits = "release"
|
|||||||
# for profiling
|
# for profiling
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
bitvec = [ "dep:bitvec" ]
|
bitvec = [ "dep:bitvec" ]
|
||||||
|
|
||||||
@ -33,7 +31,7 @@ const_fn = "0.4"
|
|||||||
either = "1.13"
|
either = "1.13"
|
||||||
indicatif = "0.17"
|
indicatif = "0.17"
|
||||||
lazy_static = "1.5"
|
lazy_static = "1.5"
|
||||||
nohash-hasher = "0.2.0"
|
nohash-hasher = "0.2"
|
||||||
num = "0.4"
|
num = "0.4"
|
||||||
rand = "0.9"
|
rand = "0.9"
|
||||||
static_assertions = "1.1"
|
static_assertions = "1.1"
|
||||||
|
|||||||
@ -13,7 +13,7 @@ pub struct ComplexAgent {
|
|||||||
impl ComplexAgent {
|
impl ComplexAgent {
|
||||||
pub const fn new(color: Piece) -> Self {
|
pub const fn new(color: Piece) -> Self {
|
||||||
const CONFIG: FutureMoveConfig = FutureMoveConfig {
|
const CONFIG: FutureMoveConfig = FutureMoveConfig {
|
||||||
max_depth: 9,
|
max_depth: 10,
|
||||||
start_pruning_at_minus: 4,
|
start_pruning_at_minus: 4,
|
||||||
top_k_children: 2,
|
top_k_children: 2,
|
||||||
up_to_mod: 4,
|
up_to_mod: 4,
|
||||||
|
|||||||
@ -263,14 +263,16 @@ impl FutureMoves {
|
|||||||
/// Returns a boolean, `true` if the operation was successful, false if not
|
/// Returns a boolean, `true` if the operation was successful, false if not
|
||||||
#[must_use = "You must check if the root was properly set"]
|
#[must_use = "You must check if the root was properly set"]
|
||||||
pub fn update_root_coord(&mut self, i: usize, j: usize) -> bool {
|
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
|
self.arena
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.find(|(_, node)| {
|
.find(|(_, node)| node.parent == self.current_root && node.coords() == (i, j))
|
||||||
node.parent == self.current_root
|
|
||||||
&& self.current_root.is_some()
|
|
||||||
&& node.coords() == (i, j)
|
|
||||||
})
|
|
||||||
.map(|x| x.0)
|
.map(|x| x.0)
|
||||||
// do raw set so we can prune it on the next move (in `update`)
|
// do raw set so we can prune it on the next move (in `update`)
|
||||||
.inspect(|&root| self.update_root_idx_raw(root))
|
.inspect(|&root| self.update_root_idx_raw(root))
|
||||||
|
|||||||
@ -54,7 +54,6 @@ impl Move {
|
|||||||
self_value: 0,
|
self_value: 0,
|
||||||
};
|
};
|
||||||
m.self_value = m.compute_self_value(agent_color);
|
m.self_value = m.compute_self_value(agent_color);
|
||||||
m.value = Some(m.self_value as i128);
|
|
||||||
m
|
m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,8 @@ pub mod repr;
|
|||||||
fn main() {
|
fn main() {
|
||||||
let player1 = complexagent::ComplexAgent::new(Piece::Black);
|
let player1 = complexagent::ComplexAgent::new(Piece::Black);
|
||||||
// let player2 = complexagent::ComplexAgent::new(Piece::White);
|
// let player2 = complexagent::ComplexAgent::new(Piece::White);
|
||||||
// let player2 = agent::ManualAgent::new(Piece::White);
|
let player2 = agent::ManualAgent::new(Piece::White);
|
||||||
let player2 = agent::RandomAgent::new(Piece::White);
|
// let player2 = agent::RandomAgent::new(Piece::White);
|
||||||
let mut game = Game::new(Box::new(player1), Box::new(player2));
|
let mut game = Game::new(Box::new(player1), Box::new(player2));
|
||||||
game.game_loop();
|
game.game_loop();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user