From 59fec1f1e61ebf2f6fb39e39b678a16ce11c7b69 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 13 Feb 2024 20:21:09 +0100 Subject: [PATCH] ljsalkjfsalkj --- .envrc | 1 + main.py | 11 +++++++++++ shell.nix | 11 +++++++++++ 3 files changed, 23 insertions(+) create mode 100644 .envrc create mode 100644 main.py create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/main.py b/main.py new file mode 100644 index 0000000..d79aa9b --- /dev/null +++ b/main.py @@ -0,0 +1,11 @@ +import numpy as n,pygame as p +q=(999,)*2 +b=n.random.rand(*q)>.3 +t=p.display +r=n.roll +o=p.surfarray.pixels2d(t.set_mode(q)) +while 1: + w=sum(r(r(b,a,0),c,1)for a in[-1,0,1]for c in[-1,0,1]) + b=b&((w==3)|(w==4))|((~b)*(w==3)) + o[:,:]=0-b + t.flip() diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..0354034 --- /dev/null +++ b/shell.nix @@ -0,0 +1,11 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + packages = with pkgs; [ + (python3.withPackages ( ps: with ps; [ + numpy + pygame + ptpython + ])) + ]; +}