src/GameOfLife/Board.php
/**
     * Copies a board into this board object.
     * This function is necessary because cloning would change the pointer address of the variable since it creates a new board.
     * Therefore the resulting board is no longer the board that you originally wanted to change.
     *
     * @param Board $_board The board that will be cloned
     */
Copies a board into this board object.
This function is necessary because cloning would change the pointer address of the variable since it creates a new board.
Therefore the resulting board is no longer the board that you originally wanted to change.

@param Board $_board The board that will be cloned
Copies a board into this board object . This function is necessary because cloning would change the pointer address of the variable since it creates a new board . Therefore the resulting board is no longer the board that you originally wanted to change . @param Board $_board The board that will be cloned
function copy(Board $_board)
    {
        $this->gameStep = $_board->gameStep;
        $this->hasBorder = $_board->hasBorder;
        $this->height = $_board->height;
        $this->maxSteps = $_board->maxSteps;
        $this->width = $_board->width;
        $this->fields = array();
        foreach ($_board->fields() as $y => $row)
        {
            foreach ($row as $x => $field)
            {
                $this->fields[$y][$x] = clone $field;
                $this->fields[$y][$x]->setParentBoard($this);
            }
        }
    }
function copy ( Board $ _board ) { $ this -> gameStep = $ _board -> gameStep ; $ this -> hasBorder = $ _board -> hasBorder ; $ this -> height = $ _board -> height ; $ this -> maxSteps = $ _board -> maxSteps ; $ this -> width = $ _board -> width ; $ this -> fields = array ( ) ; foreach ( $ _board -> fields ( ) as $ y => $ row ) { foreach ( $ row as $ x => $ field ) { $ this -> fields [ $ y ] [ $ x ] = clone $ field ; $ this -> fields [ $ y ] [ $ x ] -> setParentBoard ( $ this ) ; } } }
Copies a board into this board object.
Copies a board into this board object .