|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2023-07-14 (4 months ago) ||Not enough user ratings||Total: 28 ||All time: 10,973 This week: 113|
This package is an implementation of the game of life simulation.
It provides classes that implement a board for the game of life defined by John Horton Conway's simulation of the dynamic of the life of beings that exist in an ecosystem.
The package provides classes that encapsulate the behavior of live cells in the life board game and can move by themselves according to the rules applied in each game iteration.
It can also display the game board on a Web page with the symbols representing the cells appearing in each position of the game board grid.
|Game of Life is a concept created by John Horton Conway to define how the life of cells will happen in an ecosystem limited by rules.
The life of the cells can be animated and displayed on a board so the users can see what happens to the cells after each game iteration.
This package implements a PHP version of the Game of Life. The package can render the changes to the life of the cells in a Web page updated by this package on each iteration.
require_once __DIR__ . '/vendor/autoload.php';
/*$liveCells = [
new LiveCell(1, 4),
new LiveCell(2, 3),
new LiveCell(2, 4),
//$ignoredEdgesAlgorithm = new NextGenerationIgnoredEdge();
$liveCells = [
new LiveCell(0, 2),
new LiveCell(1, 3),
new LiveCell(2, 1),
new LiveCell(2, 2),
new LiveCell(2, 3),
$wrapAroundEdgesAlgorithm = new NextGenerationWrapAroundEdge();
$board = new Board(new GridFactory(...$liveCells), 5, 6);
$iterations = 5;
$gameConfig = new GameConfig(
Game of life exersice solution
Build the image
docker image build --tag terdia07/php-7.4 .
Run th container
docker container run -d --name game_of_life --publish 80:80 --mount type=bind,source="$(pwd)",target=/var/www/html terdia07/php-7.4
Enter the container
docker exec -it game_of_life bash
Install phpunit and setup autoloading by running:
cd /var/www/html && composer install
./vendor/bin/phpunit tests --testdox
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.