src/GameOfLife/Rules/CustomRule.php
/**
     * Parses a <stayAlive>G<stayAlive/birth> string and sets the birth and stay alive rules.
     *
     * @param String $_rulesString
     */
Parses a G string and sets the birth and stay alive rules.
@param String $_rulesString
Parses a G string and sets the birth and stay alive rules . @param String $_rulesString
private function parseAlternateNotationString(String $_rulesString)
    {
        $ruleParts = explode("G", $_rulesString);
        $this->rulesBirth = $this->getRulesFromNumericString($ruleParts[count($ruleParts) - 1]);
        $this->rulesStayAlive = $this->getRulesFromNumericString($ruleParts[count($ruleParts) - 1]);
        if (count($ruleParts) > 1)
        {
            $this->rulesStayAlive = array_merge($this->rulesStayAlive, $this->getRulesFromNumericString($ruleParts[0]));
            sort($this->rulesStayAlive);
        }
    }
private function parseAlternateNotationString ( String $ _rulesString ) { $ ruleParts = explode ( " G " , $ _rulesString ) ; $ this -> rulesBirth = $ this -> getRulesFromNumericString ( $ ruleParts [ count ( $ ruleParts ) - 1 ] ) ; $ this -> rulesStayAlive = $ this -> getRulesFromNumericString ( $ ruleParts [ count ( $ ruleParts ) - 1 ] ) ; if ( count ( $ ruleParts ) > 1 ) { $ this -> rulesStayAlive = array_merge ( $ this -> rulesStayAlive , $ this -> getRulesFromNumericString ( $ ruleParts [ 0 ] ) ) ; sort ( $ this -> rulesStayAlive ) ; } }
Parses a <stayAlive>G<stayAlive/birth> string and sets the birth and stay alive rules.
Parses a <stayAlive > G<stayAlive / birth > string and sets the birth and stay alive rules .