Skip to content

8dcc/rule110

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Rule 110

Rule 110 made in C.

ASCII version and Netpbm version.



Forks Stars

Table of contents

  1. ASCII
  2. Netpbm
  3. Examples
  4. Todo

ASCII

You can see an example here.

ASCII Configuration

Display

  • STEPS: The ammount of lines to be printed.
  • MAX_LINE_LEN: Won't print characters that exceed this position. If the value is 0, it will turn off this option.

Characters

  • FILLCHAR: The character that the program will print as 1.
  • EMPTYCHAR: The character that the program will print as 0.

Settings

  • PRINT_DETAILS: If 1, it will print useful information before displaying the simulation.

ASCII Functions

int calc_rule(int a, int b, int c, int mode);

a, b and c are the states of the cells, left to right. mode == 1 will switch the variables a and b.

  • mode == 0:

    a b c
      r  
    1 0 0
      0  
  • mode == 1:

    c b a
      r  
    0 0 1
      0  

Where r is the value returned.

Netpbm

You can see an example here.

Netpbm Usage

rule110-netpbm.o > output.pbm

Netpbm Configuration

Display

  • HEIGHT: The height of the .pbm file.
  • WIDTH: The width of the .pbm file.

Netpbm Functions

int calc_rule(int a, int b, int c, int mode);
int calc_array();

Examples

Example image 1

Example image 2

Todo

  • The image does weird shit depending on the width. If HEIGHT > WIDTH, the image is ok.
  • Format the code for the ascii version.v
  • Format the code for the pmb version.v
  • Add compile.sh
  • Make the simulation infinite if steps is 0.
  • Make a version in SDL2?