Last active
August 9, 2023 23:12
-
-
Save DavidBuchanan314/2280bff6e579e4c4ec9cd925a9ed9fea to your computer and use it in GitHub Desktop.
Yet another reformatting of my tiny game of life implementation. Valid ANSI C with no (default) compiler warnings or UB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define F\ | |
for(i=l;i\ | |
<l*4; i++) | |
main(){int | |
i,j,w=512, | |
n,l=w*w,o[ | |
]={~w,-w,- | |
w+1,-1,1,w | |
-1,w,w+1}, | |
b[l*5];F b | |
[i]=rand();for(puts("YUV4MPEG\ | |
2 W512 H512 C444");puts("FRAM\ | |
E");){F{for(n=j=8;j;n-=1&b[i+o | |
[--j]]);b[i+l]=(n^5&&!b[i]|n^6 | |
)-1;}F putchar(b[i]=b[i+l]);}} | |
/* gcc life.c;./a.out|mpv - */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm used these 24 bytes to deal with any warnings that GCC and Clang can see. Even for Clang's
-Weverything
, but honestly, I think-Weverything
are too excessive, I didn't bother about it in my works, only care about-Wall -Wextra -pedantic
.