mirror of
https://github.com/Noratrieb/minmax.git
synced 2026-01-16 00:05:05 +01:00
shrink WIN_COUNT_TABLE
This commit is contained in:
parent
91e3573e26
commit
b9de5d27e0
1 changed files with 3 additions and 3 deletions
|
|
@ -101,7 +101,7 @@ impl Connect4 {
|
||||||
|
|
||||||
fn rate(&self, player: Player) -> Score {
|
fn rate(&self, player: Player) -> Score {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
const WIN_COUNT_TABLE: [i32; BOARD_POSITIONS] = [
|
const WIN_COUNT_TABLE: [i16; BOARD_POSITIONS] = [
|
||||||
3, 4, 6, 7, 6, 4, 3,
|
3, 4, 6, 7, 6, 4, 3,
|
||||||
2, 4, 6, 7, 6, 4, 2,
|
2, 4, 6, 7, 6, 4, 2,
|
||||||
2, 4, 6, 7, 6, 4, 2,
|
2, 4, 6, 7, 6, 4, 2,
|
||||||
|
|
@ -114,10 +114,10 @@ impl Connect4 {
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|(_, state)| **state == Some(player))
|
.filter(|(_, state)| **state == Some(player))
|
||||||
.map(|(pos, _)| WIN_COUNT_TABLE[pos])
|
.map(|(pos, _)| WIN_COUNT_TABLE[pos])
|
||||||
.sum::<i32>()
|
.sum::<i16>()
|
||||||
};
|
};
|
||||||
|
|
||||||
Score::new(score_player(player) - score_player(player.opponent()))
|
Score::new(i32::from(score_player(player) - score_player(player.opponent())))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn drop_player(&self, position: usize) -> usize {
|
pub fn drop_player(&self, position: usize) -> usize {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue