Skip to content

Instantly share code, notes, and snippets.

View tomaes's full-sized avatar
💭
Programming is for AIs. Let's go shopping.

tomaes

💭
Programming is for AIs. Let's go shopping.
View GitHub Profile
@tomaes
tomaes / p5test.js
Last active April 9, 2016 16:58
P5.js test port / conversion. Fast it is not. :/
// Sierpinski's Carpet bömbing (v3)
// p5.js port (slow...)
var img;
function setup()
{
createCanvas( 729, 729, P2D ); //729 243 324
img = createImage(729,729, RGB);
}
@tomaes
tomaes / flatenthemout.pde
Last active April 11, 2016 12:51
Sierpinsky Carpet bömbing; stylish fractal things + parallax scrolling
// PDE 3.02
// Sierpinski's Carpet bömbing (v3)
// updt: better, faster, interactive
PImage img = createImage(729,729, RGB);
void setup()
{
size( 729, 729, P2D ); //729 243 324
}
@tomaes
tomaes / csrt.c
Created March 23, 2016 21:21
...turns out PDE is slower than expected; doing the same thing in c99 (-O3'ed) is an order of magnitude faster?
// c99
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#define COUNT 200000000
#define RND_RANGE 200000000
@tomaes
tomaes / OutOfMemoryError.pde
Last active February 5, 2016 18:52
Pushing counting sort down the stairs. Still neat to sort through 350M+ numbers in ~15 seconds on a below average contemporary PC, with no multi-threading or anything fancy.
// PDE3
final int COUNT = int(pow(2,28)); // 350000000;
final int RANGE = COUNT;
int[] rn = new int[COUNT];
int[] sn = new int[COUNT];
void setup()
{
println("generating " + rn.length + " numbers");
; working title: sea changes near wallpaper city
*= $801
byte $0B, $08, $0A, $00, $9E, $34, $30, $39, $36, $00, $00, $00
chars
byte 78, 77, 73, 75, 242, 66, 97, 72
txt
byte 13, 5; color
text "E-SIRAMIS " ; 10b
@tomaes
tomaes / s_atan
Last active August 29, 2015 14:02
holy colorful patterns, batman. (c64)
0 s=4^5:f=55296:w=40:c=85:h=198:z=z+.05:fory=.to24:forx=.to39
1 v=abs(atn(sin(x*y*z)*.5)*3):pokes+y*w+x,c+v:pokef+y*w+x,4+v:nextx,y
3 print"{home}[key]":pokeh,.:waith,1:goto
@tomaes
tomaes / heart curve (c128)
Created May 30, 2014 06:02
Someone was asking for this. ;)
1 rem c128 heart curve
2 color 4,5: rem bg
4 color 0,1: rem screen
6 color 1,3: rem drawing color
8 graphic 1,1:h=200:hh=100:wh=160:cw=10:ch=6
10 forx=-.99to1step.06
20 q=sqr(1-x*x)
22 y0=sqr(x*x)-q
24 y1=sqr(x*x)+q
44 xa=int((x+1)*wh):ya=h-int((y0+1)*hh)
@tomaes
tomaes / micro note
Last active August 29, 2015 14:01
mini note file viewer. rev2 with multi-page support. (c64)
;
; a minimal noter example with generated audio, BASIC header and multi-page support
;
* = $801
; 0 SYS4096
byte $0B, $08, $00, $00, $9E, '4', '0', '9', '6', $00, $00, $00
* = $1000
@tomaes
tomaes / flower tower
Last active August 29, 2015 14:01
54 wasteful bytes; looks kinda neat though. interactive. (c64)
;
; wallpaper scroll / flower tower (interactive)
;
* = 4096
lda #6
sta $d020
start ;
; user input to init field color and width
;
@tomaes
tomaes / Plop-8
Last active August 29, 2015 14:01
Mini step sequencer. 7 volume levels per cell. Press <1> to <8> to program some ploppy beats. 116 bytes. c64 again.
0 n=54296:geti:s(i)=(s(i)+1)and7:fori=1to8:poke1024+i,s(i):next:p=(p+1)and7
2 poke1065+p,30:fori=.to99:next:poke1065+p,32:poken,s(p+1):poken,.:goto