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 / typefaster (c64)
Last active March 31, 2020 14:59
game?
0 c$=chr$(65+rnd(1)*26):?c$"?";:fori=sto4^5:next:s=s+9:geta$:?a$:ifa$=c$then0
@tomaes
tomaes / joystick test (c64)
Last active December 14, 2015 01:39
for when "10 print peek(56320): goto 10" is not enough
10 rem joystick port test mini tool, press <space> to switch ports
20 p=56320:s=0
30 print" {return*2}{cyan} joystick (#"str$(2-s)") port"p+s"{return*2}"
40 j=peek(p+s): print"{up*2}{light gray} 0 1 2 3 4 5 6 7 val{light blue}"
50 geta$:if a$=" " then s=abs(s-1):print"{up*4}";:goto 30
60 print abs((jand1)>0)abs((jand2)>0)abs((jand4)>0)abs((jand8)>0);
70 print abs((jand16)>0)abs((jand32)>0)abs((jand64)>0)abs((jand128)>0);j
80 goto 40
@tomaes
tomaes / pattern drawing performance (c64)
Created February 21, 2013 12:47
some pattern drawing methods benchmarked (c64)
0 rem char screen pattern drawing methods and performance / commodore basic v2.0 (c64)
2 rem results for lines:
3 rem 10-> 18s (!)
4 rem 20-> 9s (same as 10, but twice as fast)
5 rem 30-> 3s (no PRNG? waay faster still)
6 rem 40/50-> <= 1s (cashed string 'brush' with and without PRNG, pretty fast)
7 rem all: <= 14s
9 ti$="000000"
10 for i=0 to 999: poke 1024+i,160+rnd(0)+0.5: next i
20 a=1024:b=2023:c=160:fori=atob:pokei,c+rnd(.)+.5:next
@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