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
from random import randint | |
from copy import deepcopy | |
from os import system | |
a, b = 80, 24; x, y, n = range(a), range(b), [-1,0,1] | |
c = [[randint(0,1) for _ in x] for _ in y]; g = deepcopy(c) | |
while True: | |
t = ''.join([''.join(['*' if c[j][i] else ' ' for i in x])+'\n' for j in y]) | |
system('tput cup 18 0'); print(t, end='') |
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
;; Using srfi.1 srfi.18 srfi.27 | |
;; | |
;; gosh -u srfi.1 -u srfi.18 -u srfi.27 CGoL.scm | |
;; chibi-scheme -m srfi.1 -m srfi.18 -m srfi.27 CGoL.scm | |
(define xs 80) (define ys 38) | |
(random-source-randomize! default-random-source) | |
(define (randbinlist n) | |
(list-tabulate n (lambda (n) (random-integer 2)))) |
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
#!/bin/sh | |
xs=80 ys=24 | |
ORIGIN=$(clear) LF=' | |
' | |
if [ ! ${RANDOM} ]; then | |
set -- $(head -c $((xs * ys)) /dev/random | od -An -vtu1) | |
fi |
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
from random import randint | |
from os import system | |
from time import sleep | |
from copy import deepcopy | |
xs, ys = 210, 100 | |
c = [[randint(0,1) for _ in range(ys)] for _ in range(xs)] | |
cn = [[0 for _ in range(ys)] for _ in range(xs)] | |
while True: |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#define CN 180 | |
#define ST 80 | |
int main(void) | |
{ | |
char r[8], c[CN], cn[CN], b, x, y, z; |
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 (d2b n x) | |
(let loop ((d n) (r '())) | |
(if (= d 0) (let ((b (if (null? r) '(0) r))) | |
(append (make-list (- x (length b)) 0) b)) | |
(loop (quotient d 2) (cons (modulo d 2) r))))) | |
(define (cinit cnum) | |
(let ((ci (make-list (+ (quotient cnum 2) (modulo cnum 2)) 0))) | |
(append ci '(1) (make-list (- (quotient cnum 2) 1) 0)))) |
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
#!/bin/sh | |
cnum=180; step=80; | |
rule=0 | |
while [ $rule != 256 ]; do | |
b=$rule; for x in 0 1 2 3 4 5 6 7; do export r$x=$((b%2)) b=$((b/2)); done | |
i=0; while [ $i != $cnum ]; do export c$i=0 i=$((i+1)); done | |
export c$((cnum/2))=1 |
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
from time import sleep | |
cnum, step, r, b, = 150, 50, {}, (False,True) | |
g = [(x,y,z) for x in b for y in b for z in b] | |
for rule in range(1,256): | |
n = [int(x) for x in format(rule, '08b')] | |
for i in range(8): r[g[i]] = n[7-i] | |
c, cn = [False]*cnum, [False]*cnum | |
c[cnum//2] = 1 |
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
from time import sleep | |
q = '100100100100100' | |
r = {'0':('','','','','','')} | |
r = {**r, **{'1':('010001','100','100100100','','','')}} | |
i, m = 0, 6 | |
while q[1:]: q = q[1:]+r[q[0]][i]; i = (i+1)%m; print(q); sleep(0.1) |
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
Q=100100100100100 | |
S=000001010011100101 | |
R0001=010001; R0011=100; R0101=100100100 | |
while [ ${Q#?} ]; do | |
eval Q=${Q#?}\$R${S%${S#???}}${Q%${Q#?}} | |
S=${S#???}${S%${S#???}} | |
echo $Q | |
sleep 0.1 | |
done |
NewerOlder