always use weighted board values
This commit is contained in:
@@ -35,13 +35,15 @@ pub struct Move {
|
||||
pub is_trimmed: bool,
|
||||
}
|
||||
|
||||
pub struct MoveValueConfig {}
|
||||
|
||||
impl Move {
|
||||
pub fn new(
|
||||
coord: MoveCoord,
|
||||
board: Board,
|
||||
color: Piece,
|
||||
agent_color: Piece,
|
||||
use_weighted_bvm: bool,
|
||||
mvc: MoveValueConfig,
|
||||
) -> Self {
|
||||
let mut m = Move {
|
||||
coord,
|
||||
@@ -53,11 +55,11 @@ impl Move {
|
||||
is_trimmed: false,
|
||||
self_value: 0,
|
||||
};
|
||||
m.self_value = m.compute_self_value(agent_color, &board, use_weighted_bvm);
|
||||
m.self_value = m.compute_self_value(agent_color, &board, mvc);
|
||||
m
|
||||
}
|
||||
|
||||
fn compute_self_value(&self, agent_color: Piece, board: &Board, use_weighted_bvm: bool) -> i16 {
|
||||
fn compute_self_value(&self, agent_color: Piece, board: &Board, _mvc: MoveValueConfig) -> i16 {
|
||||
if self.winner == Winner::Player(!agent_color) {
|
||||
// if this board results in the opponent winning, MAJORLY negatively weigh this move
|
||||
// NOTE! this branch isn't completely deleted because if so, the bot wouldn't make a move.
|
||||
@@ -67,19 +69,10 @@ impl Move {
|
||||
// results in a win for the agent
|
||||
return i16::MAX - 1;
|
||||
}
|
||||
// else if self.winner == Winner::Tie {
|
||||
// // idk what a Tie should be valued?
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// I guess ignore Ties here, don't give them an explicit value,
|
||||
// because even in the case of ties, we want to have a higher score
|
||||
|
||||
match use_weighted_bvm {
|
||||
true => const { BoardValueMap::weighted() },
|
||||
false => const { BoardValueMap::flat() },
|
||||
}
|
||||
.board_value(board, agent_color)
|
||||
const { BoardValueMap::weighted() }.board_value(board, agent_color)
|
||||
}
|
||||
|
||||
/// Sort children of the [`Move`] by their self_value in `arena`
|
||||
|
||||
Reference in New Issue
Block a user