diff --git a/README.md b/README.md new file mode 100644 index 0000000..37334ca --- /dev/null +++ b/README.md @@ -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 diff --git a/src/logic/board_value.rs b/src/logic/board_value.rs index c35b676..0e60169 100644 --- a/src/logic/board_value.rs +++ b/src/logic/board_value.rs @@ -18,19 +18,28 @@ impl BoardValueMap { .sum() } + /// Weights from: https://repub.eur.nl/pub/7142/ei2005-47.pdf pub fn new() -> Self { 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() { - map.set(i, j, 1); - } - - for (i, j) in Board::sides() { - map.set(i, j, 100); - } - - for (i, j) in Board::corners() { - map.set(i, j, 1000); + map.set(i, j, POSITION_VALUES[i][j]) } Self(map)