add board weights
This commit is contained in:
parent
60aaa883c1
commit
ed101f8968
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Othello bot
|
||||||
|
|
||||||
|
|
||||||
|
## Papers:
|
||||||
|
- [An Evolutionary Learning Approach to Play
|
||||||
|
Othello Using XCS](https://www.researchgate.net/profile/Swaraj-Kumar/publication/328458543_An_Evolutionary_Learning_Approach_to_Play_Othello_Using_XCS/links/60fbe0450c2bfa282af91ed1/An-Evolutionary-Learning-Approach-to-Play-Othello-Using-XCS.pdf?origin=publication_detail)
|
||||||
|
- [Reinforcement Learning and its Application to Othello](https://repub.eur.nl/pub/7142/ei2005-47.pdf) - Board weights used
|
||||||
@ -18,19 +18,28 @@ impl BoardValueMap {
|
|||||||
.sum()
|
.sum()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Weights from: https://repub.eur.nl/pub/7142/ei2005-47.pdf
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut map = PosMap::new();
|
let mut map = PosMap::new();
|
||||||
|
assert_eq!(
|
||||||
|
Board::BOARD_SIZE,
|
||||||
|
8,
|
||||||
|
"BVM only supports Board::BOARD_SIZE of 8"
|
||||||
|
);
|
||||||
|
|
||||||
|
const POSITION_VALUES: [[i64; 8]; 8] = [
|
||||||
|
[100, -20, 10, 5, 5, 10, -20, 100],
|
||||||
|
[-20, -50, -2, -2, -2, -2, -50, -20],
|
||||||
|
[10, -2, -1, -1, -1, -1, -2, 10],
|
||||||
|
[5, -2, -1, -1, -1, -1, -2, 5],
|
||||||
|
[5, -2, -1, -1, -1, -1, -2, 5],
|
||||||
|
[10, -2, -1, -1, -1, -1, -2, 10],
|
||||||
|
[-20, -50, -2, -2, -2, -2, -50, -20],
|
||||||
|
[100, -20, 10, 5, 5, 10, -20, 100],
|
||||||
|
];
|
||||||
|
|
||||||
for (i, j) in Board::all_positions() {
|
for (i, j) in Board::all_positions() {
|
||||||
map.set(i, j, 1);
|
map.set(i, j, POSITION_VALUES[i][j])
|
||||||
}
|
|
||||||
|
|
||||||
for (i, j) in Board::sides() {
|
|
||||||
map.set(i, j, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i, j) in Board::corners() {
|
|
||||||
map.set(i, j, 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Self(map)
|
Self(map)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user