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
; 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 / 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");
@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 / 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 / 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 / oneliners.glsl
Last active February 11, 2019 10:32
shadertoy GLSL oneliners
// fragment shader one-liners
// note: some might break for timing reasons (iDate.a/iDate.w) and some for compatibility reasons ("f+=" on a Mac, f.e.)
//
// void mainImage( out vec4 f, vec2 p )
// and then...
// "flames (red)"
{f=vec4(p.x/p.y*mod(sin(p.x-iDate.a),.001*length(p-.9)),.2,.5,1.0);}
// "rain (small)"
@tomaes
tomaes / heartcash.bas
Created October 29, 2016 11:19
A symbolic 3-liner game in symbolic instruction code (vic 20)
0 v=38400:t=7680:c=164:m=50:h=211:printchr$(5):poke36879,127
1 o=((ti/m)and7)*m:geta$:x=x-(a$=" ")+(x=21)*21
2 ifpeek(t+o)<>83thenpokev+o,2:poket+o,c:?spc(x)chr$(h):goto1
@tomaes
tomaes / conveyor belt (vic 20)
Created October 29, 2016 15:55
Speed and patterns can be tweaked a lot. Also works on the 64.
0 s$=right$(s$,63)+chr$(250.3-rnd(.)):?chr$(19)s$s$s$s$s$s$s$:goto
@tomaes
tomaes / mem20.bas
Last active October 30, 2016 11:31
Short (eh) memory card game for the standard VIC20 (should work on all the 8-bit Commodore machines, I think...)
0 fori=.to7step2:m(i)=i+2:m(i+1)=i+2:next:r=1
1 forj=.to9:fori=.to7:a=int(rnd(.)*8):h=m(i):m(i)=m(a):m(a)=h:nexti,j
2 print"#:"r:fori=.to7:printi;chr$(63+(m(i)<0)):next
3 r=r+1:input"cards";a,b:if(a=b)or((m(a)orm(b))<0)goto3
5 printchr$(13)m(a)m(b)chr$(13):ifm(a)=m(b)thenm(a)=-m(a):m(b)=-m(b)
8 s=.:fori=.to7:s=s+m(i):next:if(s>-40)goto2
@tomaes
tomaes / blocktumble.txt
Last active May 30, 2019 16:51
a few notes on block tumble!
"Block Tumble!" is a humble Commodore 64 puzzle game from 1991 in 2KBytes; it features 56(!) levels.
Here are some random notes I took while poking around in memory...
observations:
- the level encoding is fixed: 18 Bytes x 56 = 1008 Bytes
- the level data starts at 0BF9 (in memory), or at 03FA (file offset)
- a better, flexible encoding of the level data should take around ~870 Bytes
(assuming a not-too-crowded field in most levels and on average at least 8 wall stones)
(also: discussing level encoding should be a separate post, as there are MANY options :))