commit 8cbad0f
pita
·
2026-08-02 11:45:56 +0000 UTC
parent 105a4eb
wow!
2 files changed,
+7,
-9
M
c/main.c
+1,
-1
1@@ -1,3 +1,3 @@
2-print "cc -std=c89 -Werror -Wall -Wextra main.c"
3+print "cc -std=c89 -Werror -Wall -Wextra -Wno-parentheses main.c"
4 wait 1
5 kill
M
c/main.c
+6,
-8
1@@ -1,16 +1,14 @@
2 #include <stdio.h>
3-#include <sys/select.h>
4+#include <poll.h>
5 #include "h.h"
6
7 int
8 main()
9 {
10- int n,k,i,c;
11- for(;;select(0,0,0,0,&(struct timeval){0,100000}),printf("\033[H")) {
12- for(i=w*h;i--;g[i]|=(n==3||(c&&n==4))<<1, i%w||putchar(10))
13- for(n=0,k=9,c=g[i]&1,putchar(46-11*c);k--;)
14- n += g[((i/w+k/3+h-1)%h)*w+(i+k%3+w-1)%w]&1;
15- for (i = w*h;i--;g[i]>>=1);
16+ int n,k,i;
17+ for(;;poll(0,0,100),puts("\033[H")) {
18+ for(i=w*h;i--;g[i]|=(n==3|n==g[i]+3)*2,i%w||putchar(10))
19+ for(n=0,k=9,putchar(46-11*g[i]);k--;n+=g[((i/w+k/3+h-1)%h)*w+(i+k%3+w-1)%w]&1);
20+ while(++i<h*w)g[i]/=2;
21 }
22- return 0;
23 }