ファイル:CA rule110s.png

提供: testwiki
ナビゲーションに移動 検索に移動
    元のファイル (10,000 × 10,000 ピクセル、ファイルサイズ: 167キロバイト、MIME タイプ: image/png)

    このファイルはウィキメディア・コモンズのものであり、他のプロジェクトで使用されている可能性があります。 ウィキメディア・コモンズでのファイル解説ページにある説明を以下に示します。

    概要

    解説 下記を参照。
    日付
    原典 原版の投稿者自身による著作物
    作者 Grondilu (talk) (Uploads)
    その他のバージョン

    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さんは、この作品を以下のライセンスで提供しています。
    Creative Commons CC-Zero このファイルはクリエイティブ・コモンズ CC0 1.0 全世界 パブリック・ドメイン提供のもとで利用可能にされています。
    ある作品に本コモンズ証を関連づけた者は、その作品について世界全地域において著作権法上認められる、その者が持つすべての権利(その作品に関する権利や隣接する権利を含む。)を、法令上認められる最大限の範囲で放棄して、パブリック・ドメインに提供しています。

    この作品は、たとえ営利目的であっても、許可を得ずに複製、改変・翻案、配布、上演・演奏することが出来ます。

    元のアップロードログ

    元のファイルページはこちら。以下の利用者は全て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;...

    キャプション

    このファイルの内容を1行で記述してください

    このファイルに描写されている項目

    題材

    28 2 2014

    9b1b62f5bf9ee9a880d31358b7337a51c56c12d9

    170,613 バイト

    10,000 ピクセル

    10,000 ピクセル

    ファイルの履歴

    過去の版のファイルを表示するには、その版の日時をクリックしてください。

    日時サムネイル寸法利用者コメント
    現在の版2023年8月4日 (金) 18:142023年8月4日 (金) 18:14時点における版のサムネイル10,000 × 10,000 (167キロバイト)wikimediacommons>Obscure2020Optimized with OxiPNG and ZopfliPNG.

    このファイルを使用しているページはありません。