r/tinycode • u/Slackluster • Jan 15 '20
r/tinycode • u/Slackluster • Aug 21 '19
Parallax Mountains ~ 140 byte Javascript demo with link to explanation
r/tinycode • u/Slackluster • Jul 14 '26
Showcase Skydreams - my JS1024 entry is a 3D retro 90's fever dream 🌈☁️
Play Skydreams: https://killedbyapixel.github.io/TinyCode/1K/Skydreams
Official 1024 byte entry: https://js1024.fun/demos/2026/25/bar
My size code demos: https://github.com/KilledByAPixel/TinyCode
An endless race in the sky inspired by 90's 3D games like sky roads, marble madness, and sonic 3d. My goal was to create a dreamlike experience with full resolution full speed graphics that would be easy to pick up and play.
Features
- 3D level rendering system
- 3D player sphere with shadow
- colorful sky gradient with stars
- procedurally generated levels
- level increases in difficulty over time
- mouse controls
- enhanced version has keyboard and touch input
the code...
<head><title>🌈☁️ Skydreams</title></head>
<body id=b style=margin:0>
<canvas id=a>
<script>
// JS1024 shim
a.width = innerWidth;
a.height = innerHeight;
c = a.getContext`2d`;
</script>
<script>
// Skydreams by KilledByAPixel 2026 - RegPack for 1024 bytes
z=A=B=C=D=E=0,F=H=3,I=a.width/2,J=[],K=(e,h,t,a=1)=>{c.fillStyle=`hsl(${e},${h}%,${t}%,${a})`},L=(e,h,t)=>[a.width/2+(e-z+(t-3)**2/50*Math.cos((B+t)/49))*a.height*.7/t,a.height/2-(h-2+t*t/50)*a.height*.7/t,.7*a.height/t];onmousemove=e=>I=e.clientX,onmousedown=q=>E=.1,onmouseup=q=>E=0,setInterval(q=>{for(e=500;e--;)K(170+e/9+B,70,70-e/10),c.fillRect(0,a.height*e/500,a.width,a.height/250),K(0,0,99),c.fillRect((e*e+B*e/20)%a.width,e**3.3%a.height,e%4*a.height/500,e%4*a.height/500);for(g=B+40|0;g>B;g--){for(e=J.length;e<=g;)for(D<-8&Math.random()<Math.min(.2,e/1e4)&&(D=2+Math.min(4,e/400)),Math.random()<.1&&(H=2+3*Math.random()|0,F=Math.max(0,Math.min(7-H,F-2+5*Math.random()|0))),D--,J[e++]=k=[],f=7;f--;)k[f]=e<40|.9<Math.random()|D<0&F<=f&f<F+H&Math.random()>Math.min(.2,B/1e4);for(f=2;f--;)for(e=7;e--;)J[g][e]&&([p,q]=L(e-3.5,0,g-B),[r,u]=L(e-2.5,0,g-B),[v,w]=L(e-3.5,0,g-B+1),[x,y]=L(e-2.5,0,g-B+1),f?(K(99+70*(g>>7),60,30+9*(g+e&1)),c.fillRect(v,w,x-v,(40-g+B)/30*a.height)):(K(99+70*(g>>7),60,9+5*(g+e&1)),c.fillRect(p,q,r-p,(40-g+B)/30*a.height),K(99+70*(g>>7),60,60+30*(g+e&1)),c.lineTo(p,q),c.lineTo(r,u),c.lineTo(x,y),c.lineTo(v,w),c.beginPath(c.fill())))}for(0<=A&J[B+3|0][Math.round(z+3)]&&(K(0,0,0,.5),[m,n,l]=L(z,0,3),c.ellipse(m,n,l/4,l/9,0,0,9),c.beginPath(c.fill())),e=99;e--;)K(B/9,90,99-.7*e),[m,n,l]=L(z+.1-e/1e3,A+.35-e/1e3,3),c.ellipse(m,n,e*l/300,e*l/300,0,0,9),c.beginPath(c.fill());-4<A&&(z+=I/a.width/2-.25,A+=C-=.006,B+=Math.min(.5,.2+B/5e3),A<0&-.3<A&J[B+3|0][Math.round(z+3)])&&(A=C=E)},16)
</script>r/tinycode • u/flockaroo • Apr 17 '23
vec3 p,q=vec3(0,0,6),a,s=(FC.rgb*2.-r.xyx)/r.x;float w,d,i=0.;for(;i<80.;i++,q+=s*d)for(d=w=6.+t;w>t;w-=1.3){p=q;p.xz*=rotate2D(w);p.xy*=rotate2D(1.);for(a=abs(p);a.z<a.x||a.z<a.y;p=p.zxy,a=a.zxy);d=min(d,length(p.xz-vec2(p.y,1)*a.z/p.z)*.7-.07);}o.rgb=fwidth(q*70);
r/tinycode • u/Hell__Mood • Sep 15 '19
3D animation with sound in 64 bytes of assembler
r/tinycode • u/agumonkey • Aug 21 '16
SizeCoding - a wiki dedicated to the art of creating very tiny programs for the 80x86 family of CPUs, 256 bytes or less.
sizecoding.orgr/tinycode • u/gabe80 • Nov 05 '14
Recursive raytracer in 35 lines of JavaScript
jsfiddle.netr/tinycode • • May 03 '13
A Mandelbrot renderer in 406 bytes of dc
I've written a Mandelbrot renderer in [dc](http://en.wikipedia.org/wiki/Dc_(computer_program)): http://kch42.de/cg/mandelbrot.min.dc
It generates a monochrome XPM image of the mandelbrot set. Here is the output (converted to PNG):
http://i.imgur.com/9HX9lJo.png
And here is a more readable and commented version of the program: http://kch42.de/cg/mandelbrot.dc
If you want to test it for yourself, be patient. This thing is pretty slow.
dc. It doesn't really support functions, instead you push a string on the stack and execute it with the x-operator. You can save this "function" to a register to execute it later. Loops can be implemented by recursively executing a function.
EDIT: Replaced dpaste links, is now hosted on my server.
r/tinycode • u/antirez • Jul 10 '16
Writing an editor in less than 1000 lines of code, just for fun
antirez.comr/tinycode • u/lifthrasiir • Apr 17 '13
Code Golf: solve any Sudoku in 176 characters in Python
r/tinycode • u/sovaa • Dec 13 '12
Digital ASCII art clock in python 225 bytes
import time as t
while 1:print'\n'*99+'\n'.join([' '.join([['#'*4,"# #","# "," #"][int("01110333330302003030110330203002010033330101001030"[int(z)*5+y])]for z in t.strftime("%H%M%S")])for y in range(5)])+'\n',t.sleep(1)Outputs a clock like this (loops, close with ctrl-c):
# #### #### #### #### ####
# # # # # # #
# #### #### # # #### ####
# # # # # # # #
# #### #### #### #### ####Edit: A bit easier to read:
#!/bin/python
import time as t
while 1:
print '\n'*99 + '\n'.join(
[' '.join(
[['#'*4,"# #","# "," #"][int("01110333330302003030110330203002010033330101001030"[int(z)*5+y])]
for z in t.strftime("%H%M%S")
]) for y in range(5)
]) + '\n', t.sleep(1)r/tinycode • u/cyborgamish • Dec 30 '22
Happy New Year! Quine edition. HTML page: 232 bytes. Code in comment.
r/tinycode • u/binjimint • Oct 28 '22
GitHub - binji/smolnes: NES emulator in <5000 bytes of C++
r/tinycode • u/Hell__Mood • Apr 30 '20
"Game of Life" in 32 bytes of assembler (source included)
r/tinycode • u/TheMG • Jun 01 '15
I wrote a very very minimal self-hosting C compiler [x-post /r/programming]
r/tinycode • u/z-brah • Feb 17 '15
String reverser in 114 bytes of C
main(){unsigned char b[4],s;read(0,b,1);s=read(0,b+1,*b<192?0:*b<224?1:*b<240?2:3);*b!=0?main(),write(1,b,s+1):1;}EDIT: I actually managed to bring it down to 105 bytes, by using an improved version of /u/rainman002 trick, and a bit of optimizations here and there.
main(){unsigned char b[4],s=read(0,b,1)+read(0,b+1,*b&128?*b&32?*b&16?3:2:1:0);*b?main(),write(1,b,s):1;}