File:CA rule110s.png

頁面內容唔支援其他語言。
出自維基百科,自由嘅百科全書

原本檔案(10,000 × 10,000 像素,檔案大細:167 KB ,MIME類型:image/png

摘要

描述 See below.
日期
來源 Own work by the original uploader
作者 Grondilu (talk) (Uploads)
Other versions

Made with the following Perl code:

use strict;
use warnings;
use GD;

package Automaton {
    sub new {
        my $class = shift;
        my $rule = [ reverse split //, sprintf "%08b", shift ];
        return bless { rule => $rule, cells => [ @_ ] }, $class;
    }
    sub next {
        my $this = shift;
        my @previous = @{$this->{cells}};
        $this->{cells} = [
            @{$this->{rule}}[
                map {
                    4 * $previous[($_ - 1) % @previous]
                    + 2 * $previous[$_]
                    + $previous[($_ + 1) % @previous]
                } 0 .. @previous - 1
            ]
        ];
        return $this;
    }
    use overload
        q{""} => sub {
            my $this = shift;
            join '', map { $_ ? '#' : ' ' } @{$this->{cells}}
        };

    sub to_image {
        my ($this, $width, $height) = @_;
        my $image = GD::Image->new($width, $height);
        my $black = $image->colorAllocate(0, 0, 0);
        my $white = $image->colorAllocate(255, 255, 255);

        my $x = 0;
        my $y = 0;
        foreach my $cell (@{$this->{cells}}) {
            if ($cell) {
                $image->setPixel($x, $y, $black);
            } else {
                $image->setPixel($x, $y, $white);
            }
            $x++;
            if ($x >= $width) {
                $x = 0;
                $y++;
                last if $y >= $height;
            }
        }
        return $image;
    }
}

my ($width, $height) = (10**4, 10**4);
my @a = map 0, 1 .. $width;
$a[$width - 1] = 1;
my $a = Automaton->new(110, @a);

# Save to file
open(my $out, '>', 'output.png') or die "Cannot open file: $!";
binmode $out;
print $out "P1\n$width $height\n";

for (1 .. $height) {
    print $out join(' ', @{$a->{cells}}) . "\n";
    $a->next;
}

close $out;


協議

Grondilu at 英文 維基百科, the copyright holder of this work, hereby publishes it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Original upload log

The original description page was here. All following user names refer to en.wikipedia.
  • 2014-02-28 08:32 Grondilu 1000×1000× (10463 bytes) Made it myself with the following Perl code: <code>use strict; use warnings; package Automaton { sub new { my $class = shift; my $rule = [ reverse split //, sprintf "%08b", shift ]; return bless { rule => $rule, cells => [ @_ ] }, $class;...

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

圖中顯示嘅係

28 2 2014

image/png

9b1b62f5bf9ee9a880d31358b7337a51c56c12d9

170,613 字節

10,000 像素

10,000 像素

檔案歷史

撳個日期/時間去睇響嗰個時間出現過嘅檔案。

日期/時間縮圖尺寸用戶註解
現時2023年8月4號 (五) 17:14響2023年8月4號 (五) 17:14嘅縮圖版本10,000 × 10,000(167 KB)Obscure2020Optimized with OxiPNG and ZopfliPNG.
2023年7月10號 (一) 21:19響2023年7月10號 (一) 21:19嘅縮圖版本10,000 × 10,000(1.75 MB)CJKVRShowing more executions
2014年2月27號 (四) 20:41響2014年2月27號 (四) 20:41嘅縮圖版本1,000 × 1,000(10 KB)GrondiluBigger version, right aligned.
2006年3月18號 (六) 17:55響2006年3月18號 (六) 17:55嘅縮圖版本500 × 250(2 KB)MaksimLa bildo estas kopiita de wikipedia:en. La originala priskribo estas: Smaller version of CA_rule110.png {{GFDL}} {| border="1" ! date/time || username || edit summary |---- | 21:57, 1 February 2005 || en:User:Quadell || <nowiki>(tagged)</nowiki> |

以下嘅1版用到呢個檔:

全域檔案使用情況

下面嘅維基都用緊呢個檔案: