https://github.com/zsarge/cgol-c
Conway's Game of Life, for the terminal, written in C
https://github.com/zsarge/cgol-c
Last synced: about 1 month ago
JSON representation
Conway's Game of Life, for the terminal, written in C
- Host: GitHub
- URL: https://github.com/zsarge/cgol-c
- Owner: zsarge
- License: mit
- Created: 2021-08-06T16:57:23.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-07T21:20:37.000Z (almost 5 years ago)
- Last Synced: 2025-01-27T14:49:33.241Z (over 1 year ago)
- Language: C
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cgol-c
Conway's Game of Life, for the terminal, written in C
---------
This is a near direct translation of [my other implementation in Go](https://github.com/zsarge/cgol-go).
I wrote this to see if switching to a non-gc'd language would make a significant performance impact.
Using the same logic in both programs, both Go and unoptimized C have roughly equivalent performance on my system.
However, compiling with the `-O3` flag causes the C version to significantly outperform Go.
I have not taken many steps towards optimization. If you are interested in optimizing Conway's Game of Life, I recommend looking into [HashLife](https://en.wikipedia.org/wiki/Hashlife) or [this StackOverflow thread](https://stackoverflow.com/questions/40485/optimizing-conways-game-of-life).
---------
`gcc main.c -o a.out && ./a.out` =
```
+--------------------------------------------------------------------------------+
| |
| |
| |
| |
| |
| X |
| X |
| XXX |
| |
| |
+--------------------------------------------------------------------------------+
```
... and so on