pub fn new(board: &Board, loc: Loc, cell: Cell) -> Movement {
        if board[loc] == Cell::Empty {
            let mut flips: Vec<_> = Movement::find_flippable_around(board, loc, cell)
                .map(|loc| CellChange::new(cell, loc))
                .collect();
            if !flips.is_empty() {
                flips.insert(0, CellChange::new(cell, loc))
            }
            Movement { flips }
        } else {
            Movement::default()
        }
    }
/// Constructs a movement for a location on the board; the move may be
/// invalid, if the location is not empty or would flip no other cells.
Constructs a movement for a location on the board; the move may be
invalid, if the location is not empty or would flip no other cells.
Constructs a movement for a location on the board ; the move may be invalid if the location is not empty or would flip no other cells .
pub fn new(board: &Board, loc: Loc, cell: Cell) -> Movement {
        if board[loc] == Cell::Empty {
            let mut flips: Vec<_> = Movement::find_flippable_around(board, loc, cell)
                .map(|loc| CellChange::new(cell, loc))
                .collect();
            if !flips.is_empty() {
                flips.insert(0, CellChange::new(cell, loc))
            }
            Movement { flips }
        } else {
            Movement::default()
        }
    }
pub fn new ( board : & Board , loc : Loc , cell : Cell ) -> Movement { if board [ loc ] == Cell :: Empty { let mut flips : Vec < _ > = Movement :: find_flippable_around ( board , loc , cell ) . map ( | loc | CellChange :: new ( cell , loc ) ) . collect ( ) ; if ! flips . is_empty ( ) { flips . insert ( 0 , CellChange :: new ( cell , loc ) ) } Movement { flips } } else { Movement :: default ( ) } }
Constructs a movement for a location on the board; the move may be
invalid, if the location is not empty or would flip no other cells.
Constructs a movement for a location on the board ; the move may be invalid if the location is not empty or would flip no other cells .
board
&Board
loc
Loc
cell
Cell
board
&Board
loc
Loc
cell
Cell