Skip to content

Commit 8aa6377

Browse files
committed
Revert "Some more implementation that didn't work out"
This reverts commit 05f07b4.
1 parent 1fd06b8 commit 8aa6377

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

examples/reversi/board.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,7 @@ impl Piece {
3434
}
3535

3636
fn valid_moves_for(tiles: &Tiles, piece: Piece) -> Vec<Position> {
37-
// ALGORITHM: Go through all rows, columns and diagonals. Look through each row forwards and
38-
// backwards. Find an empty tile followed by the other piece. If you can then find another
39-
// `piece` before finding an empty tile, the empty tile is a valid move.
40-
41-
let other = piece.other();
42-
//TODO: Convert each row into an iterator of (pos, tile)
43-
let rows = search_row(tiles.rows().enumerate().map(|(i, r)| r.enumerate().map(|(j, c)| ((i, j), c))))
44-
.chain(search_row(tiles.cols().enumerate().map(|(j, c)| c.enumerate().map(|(i, r)| ((i, j), c)))))
45-
.chain(tiles.diagonals_tlbr())
46-
.chain(tiles.diagonals_trbl())
47-
.collect();
48-
for pieces in rows {
49-
let potential_move = None;
50-
}
51-
}
52-
53-
//TODO: Change return type into iterator
54-
fn search_row<R, C>(row: R) -> Vec<Position>
55-
where R: Iterator<Item=C>,
56-
C: Iterator<Item=(Position, Option<Piece>)> {
37+
Default::default() //TODO
5738
}
5839

5940
#[derive(Debug)]

0 commit comments

Comments
 (0)