initial BVM usage (halfs performance :( )
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use crate::repr::{Board, Piece, Winner};
|
||||
|
||||
use super::board_value::BoardValueMap;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Move {
|
||||
/// `i` position of move
|
||||
@@ -28,6 +32,10 @@ pub struct Move {
|
||||
pub lazy_children: bool,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref BVM: BoardValueMap = BoardValueMap::new();
|
||||
}
|
||||
|
||||
impl Move {
|
||||
pub const fn coords(&self) -> (usize, usize) {
|
||||
(self.i, self.j)
|
||||
@@ -47,17 +55,6 @@ impl Move {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let mut self_value = self.board.net_score(agent_color) as i64;
|
||||
let corner_v_agent = Board::sides()
|
||||
.filter(|&(i, j)| self.board.get_piece(i, j, agent_color))
|
||||
.count() as i64;
|
||||
let corner_v_not_agent = Board::sides()
|
||||
.filter(|&(i, j)| self.board.get_piece(i, j, !agent_color))
|
||||
.count() as i64;
|
||||
|
||||
// make net-corner capture important
|
||||
self_value += (corner_v_agent - corner_v_not_agent) * 4;
|
||||
|
||||
self_value
|
||||
BVM.board_value(&self.board, agent_color) as i64
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user