Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/8dcc/rule110
Rule110 made in C
https://github.com/8dcc/rule110
rule110
Last synced: 4 days ago
JSON representation
Rule110 made in C
- Host: GitHub
- URL: https://github.com/8dcc/rule110
- Owner: 8dcc
- Created: 2021-11-19T13:19:11.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-24T21:52:08.000Z (over 2 years ago)
- Last Synced: 2024-04-18T17:09:34.507Z (7 months ago)
- Topics: rule110
- Language: C
- Homepage:
- Size: 93.8 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Table of contents
1. [ASCII](https://github.com/r4v10l1/rule110#ASCII)
- [Configuration](https://github.com/r4v10l1/rule110#ASCII-Configuration)
- [Functions](https://github.com/r4v10l1/rule110#ASCII-Functions)
2. [Netpbm](https://github.com/r4v10l1/rule110#Netpbm)
- [Usage](https://github.com/r4v10l1/rule110#Netpbm-Usage)
- [Configuration](https://github.com/r4v10l1/rule110#Netpbm-Configuration)
- [Functions](https://github.com/r4v10l1/rule110#Netpbm-Functions)
3. [Examples](https://github.com/r4v10l1/rule110#Examples)
4. [Todo](https://github.com/r4v10l1/rule110#Todo)## ASCII
You can see an example [here](https://raw.githubusercontent.com/r4v10l1/rule110/main/example.txt).### 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
```c
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](https://raw.githubusercontent.com/r4v10l1/rule110/main/examples/example2.png).### Netpbm Usage
```bash
rule110-netpbm.o > output.pbm
```### Netpbm Configuration
#### Display
- `HEIGHT`: The height of the `.pbm` file.
- `WIDTH`: The width of the `.pbm` file.### Netpbm Functions
```c
int calc_rule(int a, int b, int c, int mode);
int calc_array();
```
## Examples![Example image 2](https://raw.githubusercontent.com/r4v10l1/rule110/main/examples/example2.png)
## Todo
- [X] The image does weird shit depending on the width. If HEIGHT > WIDTH, the image is ok.
- [X] Format the code for the ascii version.v
- [ ] Format the code for the pmb version.v
- [ ] Add `compile.sh`
- [X] Make the simulation infinite if steps is 0.
- [ ] Make a version in SDL2?