pub fn new(width: usize, height: usize) -> Board {
        use Cell::*;

        let cells = vec![Empty; width * height];

        let mut board = Board {
            width,
            height,
            cells,
            cell_counts: HashMap::new(),
            game_over: false,
        };

        let center = Loc::new(width / 2, height / 2);
        *board.cell_at_mut(Loc::new(center.x, center.y)) = White;
        *board.cell_at_mut(Loc::new(center.x - 1, center.y - 1)) = White;
        *board.cell_at_mut(Loc::new(center.x, center.y - 1)) = Black;
        *board.cell_at_mut(Loc::new(center.x - 1, center.y)) = Black;

        board.update_board_info();

        board
    }
/// Creates a new board with the usual pattern of initial
/// cells- mostly empty.
Creates a new board with the usual pattern of initial
cells- mostly empty.
Creates a new board with the usual pattern of initial cells - mostly empty .
pub fn new(width: usize, height: usize) -> Board {
        use Cell::*;
        let cells = vec![Empty; width * height];
        let mut board = Board {
            width,
            height,
            cells,
            cell_counts: HashMap::new(),
            game_over: false,
        };
        let center = Loc::new(width / 2, height / 2);
        *board.cell_at_mut(Loc::new(center.x, center.y)) = White;
        *board.cell_at_mut(Loc::new(center.x - 1, center.y - 1)) = White;
        *board.cell_at_mut(Loc::new(center.x, center.y - 1)) = Black;
        *board.cell_at_mut(Loc::new(center.x - 1, center.y)) = Black;
        board.update_board_info();
        board
    }
pub fn new ( width : usize , height : usize ) -> Board { use Cell :: * ; let cells = vec ! [ Empty width height ] ; let mut board = Board { width , height , cells , cell_counts : HashMap :: new ( ) , game_over : false , } ; let center = Loc :: new ( width / 2 , height / 2 ) ; * board . cell_at_mut ( Loc :: new ( center . x , center . y ) ) = White ; * board . cell_at_mut ( Loc :: new ( center . x - 1 , center . y - 1 ) ) = White ; * board . cell_at_mut ( Loc :: new ( center . x , center . y - 1 ) ) = Black ; * board . cell_at_mut ( Loc :: new ( center . x - 1 , center . y ) ) = Black ; board . update_board_info ( ) ; board }
Creates a new board with the usual pattern of initial
cells- mostly empty.
Creates a new board with the usual pattern of initial cells - mostly empty .
width
usize
height
usize
width
usize
height
usize