src/GameOfLife/Outputs/ConsoleOutput.php
/**
     * Initializes the output.
     *
     * @param Getopt $_options User inputted option list
     * @param Board $_board Initial board
     */
Initializes the output.
@param Getopt $_options User inputted option list
@param Board $_board Initial board
Initializes the output . @param Getopt $_options User inputted option list @param Board $_board Initial board
public function startOutput(Getopt $_options, Board $_board)
    {
        parent::startOutput($_options, $_board);
        if ($_options->getOption("consoleOutputSleepTime") !== null)
        {
            $this->sleepTime = (int)$_options->getOption("consoleOutputSleepTime");
        }
        $this->numberOfNewLinesOutputBoard = $this->shellInformationFetcher->getNumberOfShellLines() - ($_board->height() + 8);
        if ($this->numberOfNewLinesOutputBoard < 0) $this->numberOfNewLinesOutputBoard = 0;
        $this->numberOfNewLinesFinishOutput = $this->numberOfNewLinesOutputBoard - 4;
        if ($this->numberOfNewLinesFinishOutput < 0) $this->numberOfNewLinesFinishOutput = 0;
        if (stristr(PHP_OS, "win"))
        {
            echo str_repeat("\n", 10000);
        }
    }
public function startOutput ( Getopt $ _options , Board $ _board ) { parent :: startOutput ( $ _options , $ _board ) ; if ( $ _options -> getOption ( " consoleOutputSleepTime " ) !== null ) { $ this -> sleepTime = ( int ) $ _options -> getOption ( " consoleOutputSleepTime " ) ; } $ this -> numberOfNewLinesOutputBoard = $ this -> shellInformationFetcher -> getNumberOfShellLines ( ) - ( $ _board -> height ( ) + 8 ) ; if ( $ this -> numberOfNewLinesOutputBoard < 0 ) $ this -> numberOfNewLinesOutputBoard = 0 ; $ this -> numberOfNewLinesFinishOutput = $ this -> numberOfNewLinesOutputBoard - 4 ; if ( $ this -> numberOfNewLinesFinishOutput < 0 ) $ this -> numberOfNewLinesFinishOutput = 0 ; if ( stristr ( PHP_OS , " win " ) ) { echo str_repeat ( " \n " , 10000 ) ; } }
Initializes the output.
Initializes the output .
// +8 is because: 2x border, 1x game step, 2x empty line, 3x Title // Subtract 4 new lines because 1x simulation finished, 2x empty lines, 1x Command prompt of shell /*
             * Printing 10000 new lines in order to move the scroll bar of cmd to the bottom end
             * This results in a lot less flickering on the screen
             */