src/GameOfLife/Inputs/BoardEditor/BoardEditor.php
/**
     * Adds a new board to the history.
     *
     * @param Board $_board The board
     */
Adds a new board to the history.
@param Board $_board The board
Adds a new board to the history . @param Board $_board The board
public function addBoardToHistory(Board $_board)
    {
        if (count($this->historyOfBoards) >= 0)
        {
            for ($i = 0; $i <= $this->currentBoard; $i++)
            {
                if ($_board->equals($this->historyOfBoards[$i])) return;
            }
        }
        if ($this->currentBoard == 14) array_shift($this->historyOfBoards);
        else $this->currentBoard++;
        $this->historyOfBoards[$this->currentBoard] = clone $_board;
    }
public function addBoardToHistory ( Board $ _board ) { if ( count ( $ this -> historyOfBoards ) >= 0 ) { for ( $ i = 0 ; $ i <= $ this -> currentBoard ; $ i ++ ) { if ( $ _board -> equals ( $ this -> historyOfBoards [ $ i ] ) ) return ; } } if ( $ this -> currentBoard == 14 ) array_shift ( $ this -> historyOfBoards ) ; else $ this -> currentBoard ++ ; $ this -> historyOfBoards [ $ this -> currentBoard ] = clone $ _board ; }
Adds a new board to the history.
Adds a new board to the history .