We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8687a45 commit be06018Copy full SHA for be06018
README.md
@@ -5,5 +5,6 @@ Reversi in any language.
5
6
## Features
7
8
-- [ ] List of Legal moves
+- [x] List of Legal moves
9
+- [x] Piece placement and list of pieces that were turned
10
- [ ] AI Enemy using [MiniMax Algorithm](https://en.wikipedia.org/wiki/Minimax)
src/board.rs
@@ -120,6 +120,14 @@ impl Board {
120
}
121
122
123
+ pub fn player1_count(&self) -> usize {
124
+ self.p1.iter().fold(0, |acc, &row| acc + row.count_ones()) as usize
125
+ }
126
+
127
+ pub fn player2_count(&self) -> usize {
128
+ self.p2.iter().fold(0, |acc, &row| acc + row.count_ones()) as usize
129
130
131
pub fn neighbours<T: Into<Position>>(&self, pos: T) -> Neighbours {
132
let pos = pos.into();
133
let row = pos.row();
0 commit comments