| @@ 29-38 (lines=10) @@ | ||
| 26 | * |
|
| 27 | * @return State |
|
| 28 | */ |
|
| 29 | public function getLastState(int $numIterations): State |
|
| 30 | { |
|
| 31 | do { |
|
| 32 | $state = $this->cca->getState(); |
|
| 33 | ||
| 34 | $iteration = $this->cca->cycle(); |
|
| 35 | } while ($iteration < $numIterations); |
|
| 36 | ||
| 37 | return $state; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * Run the CCA and return an array with first $numIterations states. |
|
| @@ 47-58 (lines=12) @@ | ||
| 44 | * |
|
| 45 | * @return State[] |
|
| 46 | */ |
|
| 47 | public function getFirstStates(int $numIterations): array |
|
| 48 | { |
|
| 49 | $states = []; |
|
| 50 | ||
| 51 | do { |
|
| 52 | $states[] = $this->cca->getState(); |
|
| 53 | ||
| 54 | $iteration = $this->cca->cycle(); |
|
| 55 | } while ($iteration < $numIterations); |
|
| 56 | ||
| 57 | return $states; |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Run the CCA and return the first looping states it encounters. If no loop is found within $maxIterations, |
|