commit 538aee4
pita
·
2026-07-30 22:09:39 +0000 UTC
parent 538aee4
init
6 files changed,
+47,
-0
+1,
-0
1@@ -0,0 +1 @@
2+print "cc -std=c89 -Werror -Wall -Wextra main.c"
+1,
-0
1@@ -0,0 +1 @@
2+os.execute("cotton build.cot")
+2,
-0
1@@ -0,0 +1,2 @@
2+#!/bin/bash
3+lua5.3 build.lua | sh
A
c/h.h
+14,
-0
1@@ -0,0 +1,14 @@
2+/* fun */
3+short grid[1024];
4+int _main();
5+
6+#define main(...) \
7+ main(void) { \
8+ grid[1 * 32 + 0] = 1; \
9+ grid[2 * 32 + 1] = 1; \
10+ grid[0 * 32 + 2] = 1; \
11+ grid[1 * 32 + 2] = 1; \
12+ grid[2 * 32 + 2] = 1; \
13+ return _main(); \
14+ }; \
15+ int _main(void)
A
c/main.c
+28,
-0
1@@ -0,0 +1,28 @@
2+#include <stdio.h>
3+#include <sys/select.h>
4+#include "h.h"
5+
6+int
7+main(void)
8+{
9+ for (;;select(0,0,0,0,&(struct timeval){0,100000})) {
10+ printf("\033[2J\033[3J\033[H");
11+ int x,y,n,k,i;
12+
13+ for(y=32; y--; putchar(10))
14+ for(x=32; x--;) {
15+ n=0, k=9;
16+
17+ for(putchar(46-11*(grid[y*32+x]&1)); k--;)
18+ n += grid[((y+(k/3-1)+32)%32)*32
19+ +((x+(k%3-1)+32)%32)]&1;
20+
21+ grid[y*32+x]|=(n==3||(grid[y*32+x]&1&&n==4))<<1;
22+ }
23+
24+ for (i = 1024; i--;)
25+ grid[i] >>= 1;
26+ }
27+
28+ return 0;
29+}
A
readme
+1,
-0
1@@ -0,0 +1 @@
2+game of life, only c now i spent too much time on this one