protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('---------------------------');
     $output->writeln('Welcome to the game of life');
     $output->writeln('---------------------------');
     $dimension = $input->getArgument('dimension');
     $universe = new Universe($dimension);
     $universe->buildRandomUniverse();
     while (true) {
         echo $universe->paint();
         $universe->envolve();
     }
 }
Exemplo n.º 2
0
 public function testEnvolveDies()
 {
     //arrange
     $universe = new Universe(3);
     //Act
     $row = array(1, 0, 1);
     $test_universe[] = $row;
     $test_universe[] = $row;
     $test_universe[] = $row;
     $universe->setArrayUniverse($test_universe);
     $universe->envolve();
     //assert
     $array_universe = $universe->getArrayUniverse();
     $this->assertTrue($array_universe[0][0] == 0);
 }