src/GameOfLife/GameOfLife.php
/**
     * Parses the options and returns whether the simulation shall be started or not.
     *
     * @return Bool Indicates whether the simulation shall be started or not
     */
Parses the options and returns whether the simulation shall be started or not.
@return Bool Indicates whether the simulation shall be started or not
Parses the options and returns whether the simulation shall be started or not . @return Bool Indicates whether the simulation shall be started or not
public function initialize(): Bool
    {
        try
        {
            $this->optionHandler->initializeOptions($this->options);
        }
        catch (\Exception $_exception)
        {
            echo "\nError while initializing the options: " . $_exception->getMessage() . "\n\n";
            return false;
        }
        try
        {
            $this->options->parse();
        }
        catch (\Exception $_exception)
        {
            echo "\nError while parsing the options: " . $_exception->getMessage() . "\n\n";
            return false;
        }
        $generalOptionUsed = $this->optionHandler->optionParser()->parseGeneralOptions($this->options);
        if ($generalOptionUsed) return false;
        try
        {
            $this->board = $this->optionHandler->optionParser()->parseBoardOptions($this->options);
        }
        catch (\Exception $_exception)
        {
            echo "\nError while parsing the board options: " . $_exception->getMessage() . "\n\n";
            return false;
        }
        try
        {
            $this->input = $this->optionHandler->optionParser()->parseInputOptions($this->options);
        }
        catch (\Exception $_exception)
        {
            echo "\nError while parsing the input options: " . $_exception->getMessage() . "\n\n";
            return false;
        }
        try
        {
            $this->output = $this->optionHandler->optionParser()->parseOutputOptions($this->options);
        }
        catch (\Exception $_exception)
        {
            echo "\nError while parsing the output options: " . $_exception->getMessage() . "\n\n";
            return false;
        }
        try
        {
            $rule = $this->optionHandler->optionParser()->parseRuleOptions($this->options);
        }
        catch (\Exception $_exception)
        {
            echo "\nError while parsing the rule options: " . $_exception->getMessage() . "\n\n";
            return false;
        }
        try
        {
            $rule->initialize($this->options);
        }
        catch (\Exception $_exception)
        {
            echo "\nError while initializing the rule: " . $_exception->getMessage() . "\n\n";
            return false;
        }
        $this->gameLogic = new GameLogic($rule);
        return true;
    }
public function initialize ( ) : Bool { try { $ this -> optionHandler -> initializeOptions ( $ this -> options ) ; } catch ( \ Exception $ _exception ) { echo " \n Error while initializing the options:  " . $ _exception -> getMessage ( ) . " \n \n " ; return false ; } try { $ this -> options -> parse ( ) ; } catch ( \ Exception $ _exception ) { echo " \n Error while parsing the options:  " . $ _exception -> getMessage ( ) . " \n \n " ; return false ; } $ generalOptionUsed = $ this -> optionHandler -> optionParser ( ) -> parseGeneralOptions ( $ this -> options ) ; if ( $ generalOptionUsed ) return false ; try { $ this -> board = $ this -> optionHandler -> optionParser ( ) -> parseBoardOptions ( $ this -> options ) ; } catch ( \ Exception $ _exception ) { echo " \n Error while parsing the board options:  " . $ _exception -> getMessage ( ) . " \n \n " ; return false ; } try { $ this -> input = $ this -> optionHandler -> optionParser ( ) -> parseInputOptions ( $ this -> options ) ; } catch ( \ Exception $ _exception ) { echo " \n Error while parsing the input options:  " . $ _exception -> getMessage ( ) . " \n \n " ; return false ; } try { $ this -> output = $ this -> optionHandler -> optionParser ( ) -> parseOutputOptions ( $ this -> options ) ; } catch ( \ Exception $ _exception ) { echo " \n Error while parsing the output options:  " . $ _exception -> getMessage ( ) . " \n \n " ; return false ; } try { $ rule = $ this -> optionHandler -> optionParser ( ) -> parseRuleOptions ( $ this -> options ) ; } catch ( \ Exception $ _exception ) { echo " \n Error while parsing the rule options:  " . $ _exception -> getMessage ( ) . " \n \n " ; return false ; } try { $ rule -> initialize ( $ this -> options ) ; } catch ( \ Exception $ _exception ) { echo " \n Error while initializing the rule:  " . $ _exception -> getMessage ( ) . " \n \n " ; return false ; } $ this -> gameLogic = new GameLogic ( $ rule ) ; return true ; }
Parses the options and returns whether the simulation shall be started or not.
Parses the options and returns whether the simulation shall be started or not .