Skip to content

Instantly share code, notes, and snippets.

tomaes

  • Germany
View GitHub Profile
@tomaes
tomaes / mem20.bas
Last active Oct 30, 2016
Short (eh) memory card game for the standard VIC20 (should work on all the 8-bit Commodore machines, I think...)
View mem20.bas
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 / conveyor belt (vic 20)
Created Oct 29, 2016
Speed and patterns can be tweaked a lot. Also works on the 64.
View conveyor belt (vic 20)
0 s$=right$(s$,63)+chr$(250.3-rnd(.)):?chr$(19)s$s$s$s$s$s$s$:goto
@tomaes
tomaes / heartcash.bas
Created Oct 29, 2016
A symbolic 3-liner game in symbolic instruction code (vic 20)
View heartcash.bas
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 / oneliners.glsl
Last active Feb 11, 2019
shadertoy GLSL oneliners
View oneliners.glsl
// 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 / p5test.js
Last active Apr 9, 2016
P5.js test port / conversion. Fast it is not. :/
View p5test.js
// 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 Apr 11, 2016
Sierpinsky Carpet bömbing; stylish fractal things + parallax scrolling
View flatenthemout.pde
// 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 Mar 23, 2016
...turns out PDE is slower than expected; doing the same thing in c99 (-O3'ed) is an order of magnitude faster?
View csrt.c
// 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 Feb 5, 2016
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.
View OutOfMemoryError.pde
// 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");
View northern_lights
; 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 Aug 29, 2015
holy colorful patterns, batman. (c64)
View s_atan
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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.