8000 GitHub - mark-gerarts/wireworld-php: Wireworld cellular automaton written in PHP
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mark-gerarts/wireworld-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wireworld

Wireworld cellular automaton written in PHP.

sample gif

Installation

Requires PHP 7.4+ and composer.

$ git clone https://github.com/mark-gerarts/wireworld-php.git
$ cd wireworld-php/
$ composer install
$ chmod +x wireworld

Usage

$ ./wireworld schemas/repeater.wire

Rules

Wireworld rules are explained here. To summarize:

A cell has one of four states. After every step, the cell updates its state according to the following rules:

  • Empty → Empty
  • Electron head → Electron tail
  • Electron tail → Connector
  • Connector
    • Electron head if exactly one or two neighbouring cells are electron heads
    • Remains connector otherwise.

Schema files

Schemas are simple text files representing the starting state of a Wireworld automaton. It uses following characters:

  • (space): empty cell
  • #: connector
  • H: electron head
  • t: electron tail

For example, an AND gate:

H##########
           ###
        # #   #
H###   ###    #
    # # # # # #  #####
    # #    ###  #
    # #     # ##
     #

Take a look at schemas for a list of predefined schemas.

Basic mode

By default, CLI Menu is used to render the simulation. Use --mode=basic for a, well, more basic version.

$ ./wireworld schemas/diodes.wire --mode=basic
Starting simulation..

      ░░     
█░░░░░░ ░░░░░
      ░░     
             
      ░░     
█░░░░░ ░░░░░░
      ░░     

[S]tep / [r]estart / [q]uit: 

      ░░     
▒█░░░░░ ░░░░░
      ░░     
             
      ░░     
▒█░░░░ ░░░░░░
      ░░     

[S]tep / [r]estart / [q]uit: 

      ░░     
░▒█░░░░ ░░░░░
      ░░     
             
      ░░     
░▒█░░░ ░░░░░░
      ░░     

[S]tep / [r]estart / [q]uit: q

About

Wireworld cellular automaton written in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0