-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f1fa297
commit 67d090f
Showing
392 changed files
with
865 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,65 @@ | ||
<?php | ||
|
||
error_reporting( E_ALL ); | ||
|
||
ini_set( 'display_errors', 1 ); | ||
ini_set( 'memory_limit', '1024M' ); | ||
ini_set( 'max_execution_time', '9999' ); | ||
|
||
for ( $rule = 0; $rule <= 255; $rule ) { | ||
|
||
$width = 256; | ||
$height = 128; | ||
|
||
$image = imagecreatetruecolor( $width, $height ); | ||
|
||
$color = imagecolorallocate( $image, 255, 255, 255 ); | ||
|
||
imagesetpixel( $image, $width / 2, 0, $color ); // Draw the initial cell | ||
|
||
$current = array( $width / 2 ); | ||
$next = array(); | ||
|
||
for ( $y = 0; $y < $height; $y ) { | ||
|
||
// We need to calculate from way before the start of the image until way before the end | ||
// because if not the code will asume that everything beyond the image is just black | ||
// but under many rules it isn't | ||
for ( $x = -$width; $x < $width * 2; $x ) { | ||
|
||
$left = in_array( $x - 1, $current ); | ||
$center = in_array( $x, $current ); | ||
$right = in_array( $x 1, $current ); | ||
|
||
$binary = sprintf( "d", decbin( $rule ) ); // Convert to binary keeping the leading zeros | ||
|
||
if ( $left and $center and $right ) { | ||
$state = $binary[0]; | ||
} else if ( $left and $center and !$right ) { | ||
$state = $binary[1]; | ||
} else if ( $left and !$center and $right ) { | ||
$state = $binary[2]; | ||
} else if ( $left and !$center and !$right ) { | ||
$state = $binary[3]; | ||
} else if ( !$left and $center and $right ) { | ||
$state = $binary[4]; | ||
} else if ( !$left and $center and !$right ) { | ||
$state = $binary[5]; | ||
} else if ( !$left and !$center and $right ) { | ||
$state = $binary[6]; | ||
} else if ( !$left and !$center and !$right ) { | ||
$state = $binary[7]; | ||
} | ||
|
||
if ( $state == 0 ) { | ||
continue; | ||
} else if ( $state == 1 ) { | ||
imagesetpixel( $image, $x, $y 1, $color ); | ||
} | ||
$next[] = $x; | ||
} | ||
$current = $next; | ||
$next = array(); | ||
} | ||
imagepng( $image, "images/$rule.png" ); | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,78 @@ | ||
<?php | ||
|
||
class Image { | ||
|
||
public $width; | ||
public $height; | ||
public $image; | ||
public $color; | ||
|
||
function __construct( $width, $height ) { | ||
$this->width = $width; | ||
$this->height = $height; | ||
$this->image = imagecreatetruecolor( $width, $height ); | ||
} | ||
|
||
function save( $filename ) { | ||
imagepng( $this->image, $filename ); | ||
return $this; | ||
} | ||
|
||
function draw() { | ||
header( 'Content-Type: image/png' ); | ||
imagepng( $this->image ); | ||
return $this; | ||
} | ||
|
||
function destroy() { | ||
imagedestroy( $this->image ); | ||
return null; //Or return $this? | ||
} | ||
|
||
function __destruct() { | ||
$this->destroy(); | ||
} | ||
|
||
//Drawers | ||
|
||
function drawPoint( $x, $y ) { | ||
return imageline( $this->image, $x, $y, $x, $y, $this->color ); | ||
} | ||
|
||
function drawLine( $x1, $y1, $x2, $y2 ) { | ||
return imageline( $this->image, $x1, $y1, $x2, $y2, $this->color ); | ||
} | ||
|
||
function drawArc( $cx, $cy, $width, $height, $start, $end ) { | ||
return imagearc( $this->image, $cx, $cy, $width, $height, $start, $end, $this->color ); | ||
} | ||
|
||
function drawCircle( $x, $y, $radius ) { | ||
return imagearc( $this->image, $x, $y, $radius * 2, $radius * 2, 0, 0, $this->color ); | ||
} | ||
|
||
function drawRectangle( $x1, $y1, $x2, $y2 ) { | ||
return imagerectangle( $this->image, $x1, $y1, $x2, $y2, $this->color ); | ||
} | ||
|
||
function drawString( $string, $x = 0, $y = 0, $font = 0 ) { | ||
return imagestring( $this->image, $font, $x, $y, $string, $this->color ); | ||
} | ||
|
||
//Getters | ||
|
||
function getWidth() { | ||
return imagesx( $this->image ); | ||
} | ||
|
||
function getHeight() { | ||
return imagesy( $this->image ); | ||
} | ||
|
||
//Setters | ||
|
||
function setColor( $red, $blue, $green ) { | ||
$this->color = imagecolorallocate( $this->image, $red, $blue, $green ); | ||
return $this; | ||
} | ||
} |
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,80 @@ | ||
<?php | ||
|
||
require 'Image.php'; | ||
|
||
// There are 19682 possible rules | ||
$RULES = array( 0, 100, 1200, 1500, 1800, 2500, 3200, 3400, 3600, 4200, 4300, 5200, 5600, 6100, 6400, 6600, 7500, 8200, 8600, 10500, 10700, 11500, 12300, 12600, 12900, 13400, 13600, 13700, 14000, 14200, 15000, 15500, 16500, 17000, 17200, 17800 ); | ||
|
||
foreach ( $RULES as $key => $rule ) { | ||
|
||
$ROW = array(); | ||
$ROWS = array(); | ||
|
||
$rule = base_convert( $rule, 10, 3 ); //Convert to ternary | ||
$rule = str_pad( $rule, 9, 0, STR_PAD_LEFT ); //Add leading zeroes | ||
|
||
$width = 1000; | ||
$height = 1000; | ||
|
||
//Define the first row | ||
$ROW[ 0 ] = 2; | ||
$ROWS[ 0 ] = $ROW; | ||
|
||
//Calculate the rest | ||
for ( $y = 1; $y < $height; $y ) { | ||
|
||
$PREVIOUS = $ROWS[ $y - 1 ]; | ||
|
||
for ( $x = 0; $x < $width; $x ) { | ||
|
||
if ( $PREVIOUS[ $x ] == 2 and $PREVIOUS[ $x - 1 ] == 2 ) | ||
$CURRENT[ $x ] = $rule[ 0 ]; | ||
|
||
if ( $PREVIOUS[ $x ] == 2 and $PREVIOUS[ $x - 1 ] == 1 ) | ||
$CURRENT[ $x ] = $rule[ 1 ]; | ||
|
||
if ( $PREVIOUS[ $x ] == 2 and $PREVIOUS[ $x - 1 ] == 0 ) | ||
$CURRENT[ $x ] = $rule[ 2 ]; | ||
|
||
if ( $PREVIOUS[ $x ] == 1 and $PREVIOUS[ $x - 1 ] == 2 ) | ||
$CURRENT[ $x ] = $rule[ 3 ]; | ||
|
||
if ( $PREVIOUS[ $x ] == 1 and $PREVIOUS[ $x - 1 ] == 1 ) | ||
$CURRENT[ $x ] = $rule[ 4 ]; | ||
|
||
if ( $PREVIOUS[ $x ] == 1 and $PREVIOUS[ $x - 1 ] == 0 ) | ||
$CURRENT[ $x ] = $rule[ 5 ]; | ||
|
||
if ( $PREVIOUS[ $x ] == 0 and $PREVIOUS[ $x - 1 ] == 2 ) | ||
$CURRENT[ $x ] = $rule[ 6 ]; | ||
|
||
if ( $PREVIOUS[ $x ] == 0 and $PREVIOUS[ $x - 1 ] == 1 ) | ||
$CURRENT[ $x ] = $rule[ 7 ]; | ||
|
||
if ( $PREVIOUS[ $x ] == 0 and $PREVIOUS[ $x - 1 ] == 0 ) | ||
$CURRENT[ $x ] = $rule[ 8 ]; | ||
} | ||
|
||
$ROWS[ $y ] = $CURRENT; | ||
} | ||
|
||
$image = new Image( $width, $height ); | ||
|
||
foreach ( $ROWS as $y => $ROW ) { | ||
foreach ( $ROW as $x => $value ) { | ||
if ( $value == 1 ) { | ||
$image->setColor( 0, 200, 0 ); | ||
$image->drawPoint( $x, $y ); | ||
} | ||
if ( $value == 2 ) { | ||
$image->setColor( 200, 0, 0 ); | ||
$image->drawPoint( $x, $y ); | ||
} | ||
} | ||
} | ||
|
||
//$image->draw(); | ||
|
||
$rule = base_convert( $rule, 3, 10 ); | ||
$image->save( $rule . '.png' ); | ||
} |
Binary file not shown.
Oops, something went wrong.