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 / femto racer (c64)
Last active December 14, 2015 02:19
pico racer's anorexic sister. now 2 lines of code.
4 rem femto racer; press <space> (or not) to stay on the road
6 printspc(9+sin(f)*6+6+sin(f*2)*5)"{white}: {green}:{gray}"m:f=f+.1:geta$:p=p+(a$=" ")*2+1
8 q=4^5+p:m=m+1:ifpeek(q)<>58thenpokeq,22:goto6
@tomaes
tomaes / basic chr$(32) adventure (c64)
Last active December 14, 2015 07:08
mini game. space shooter without space. and shooting.
10 print"{clear}{down*8}{14}{red}dodge!{light blue}{return}{reverse on}{162*21}";:s=54296
20 sc=1024:py=0:lv=3:w=40:t=10:ti$="000000":js=56320:poke53280,6:cl=646:zz=198
30 j=peek(js)and3:if(j<>3)thenpy=py-(j=1)+(j=2):py=pyand7
40 sp=sc+(t+py)*w+t:pokesp,62:pokesc+(t+int(rnd(.)*8))*w+19,w:pokes,2:pokes,.
50 print"{home}{down*9}":fori=.to7:print" {delete} ":next:print
60 ifpeek(sp)<>32thenlv=lv-1:pokecl,2:pokes,9:pokes,.
70 print"{up}{reverse on}>"str$(lv)"{space*12}"ti$"{light blue}":iflv>.thengoto30
80 print"{up}{reverse on}game over,score:":pokezz,.:waitzz,1:run
10 rem analogue mouse test tool
12 rem - movement detection by polling SID registers s+25/26
14 rem - left/right buttons detection by polling control port #1
16 s=54272: js=56321
18 print"{reverse on}{down}analogue mouse test{reverse off}{down*4}"
20 y$="{light gray}yes{light blue}":n$="{gray}no {light blue}"
22 h$=n$: v$=n$: lmb$=n$: rmb$=n$
24 ho=peek(s+25):vo=peek(s+26)
26 fori=.to39:next
28 if ho<>peek(s+25) then h$=y$
0 b$="19243342":fori=1to8:poke54296,val(mid$(b$,i,1)):pokes,.:forj=.to99:nextj,i:goto.
@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 / 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 / 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 / pico racer (c64)
Last active April 6, 2019 15:57
first version. ~300 byte commodore basic v2 (c64) mini game. use petcat and VICE to run on a pc. Or CBM studio. Or type it in like a man/woman/child/zombie/adventurous space person!
0 rem .-==: pico.racer :==-.
1 j=56320:p=1444:r=119:l=r+4:c=.001:printchr$(147)
2 w=peek(j):ifw=rthenx=x+1
3 ifw=lthenx=x-1
4 o=15+int(sin(m*.1)*3):ifm>20thens=s-(peek(p+x)=32)
5 pokep+x,81:printspc(o)"";:fori=0to5:ifrnd(0)>bthenprint":";:goto7
6 print" ";
7 next:pokep+x,66:m=m+1:b=b+c:prints:ifs<10thengoto2
8 print,"miles:";m
@tomaes
tomaes / whatsmore.bas
Last active May 9, 2019 13:14
Started as a qb.js experiment, but it so happens that qb.js is a very limited implementation of QBasic. Had to go back to the real thing.
' What's more? (v1.1)
' a quick guesstimation game in QBASIC
' (slightly extended version, won't run in qb.js)
DIM c%(2): cont% = 1: r% = 0: bchar% = 97 '97 = a,b / 48 = 0,1
CLS
RANDOMIZE TIMER
t = TIMER
@tomaes
tomaes / minesonar.lua
Last active May 9, 2019 13:14
the same minesonar.bas micro game in LUA
-- minesonar.bas in Lua (aka first Lua test, v2)
r, x, y = 0, math.random(8), math.random(8)
print "There is a mine hidden in an 8x8 field"
repeat
r = r + 1