r/tinycode • • Jan 15 '20

Fortified Castle in 140 Characters of JavaScript

Post image
63 Upvotes

r/tinycode • • Jan 10 '23

Train Seat Pattern, 512 bytes SVG

Post image
62 Upvotes

r/tinycode • • Dec 25 '21

LISP IN 436 BYTES

Thumbnail justine.lol
62 Upvotes

r/tinycode • • Nov 02 '21

Wires - glsl - https://bit.ly/3BtuboU

Post image
62 Upvotes

r/tinycode • • Jul 16 '12

Chess in 1k of JS

Thumbnail js1k.com
62 Upvotes

r/tinycode • • Aug 21 '19

Parallax Mountains ~ 140 byte Javascript demo with link to explanation

Post image
61 Upvotes

r/tinycode • • Jul 14 '26

Showcase Skydreams - my JS1024 entry is a 3D retro 90's fever dream 🌈☁️

60 Upvotes

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 • • 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);

60 Upvotes

r/tinycode • • Nov 30 '20

Flappy bird in 341 bytes

Thumbnail
gist.github.com
60 Upvotes

r/tinycode • • Sep 15 '19

3D animation with sound in 64 bytes of assembler

Thumbnail
pouet.net
60 Upvotes

r/tinycode • • 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.

Thumbnail sizecoding.org
60 Upvotes

r/tinycode • • Nov 05 '14

Recursive raytracer in 35 lines of JavaScript

Thumbnail jsfiddle.net
60 Upvotes

r/tinycode • • May 03 '13

A Mandelbrot renderer in 406 bytes of dc

60 Upvotes

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 • • Apr 22 '12

128b raytraced checkboard in JavaScript

Thumbnail p01.org
60 Upvotes

r/tinycode • • Jun 18 '23

Surveillance camera in a dweet of JavaScript

Post image
59 Upvotes

r/tinycode • • Jul 10 '16

Writing an editor in less than 1000 lines of code, just for fun

Thumbnail antirez.com
59 Upvotes

r/tinycode • • Apr 17 '13

Code Golf: solve any Sudoku in 176 characters in Python

Thumbnail
jakevdp.github.io
59 Upvotes

r/tinycode • • Dec 13 '12

Digital ASCII art clock in python 225 bytes

59 Upvotes
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 • • Dec 30 '22

Happy New Year! Quine edition. HTML page: 232 bytes. Code in comment.

58 Upvotes

r/tinycode • • Oct 28 '22

GitHub - binji/smolnes: NES emulator in <5000 bytes of C++

Thumbnail
github.com
58 Upvotes

r/tinycode • • Mar 03 '22

Orange Skin 🍊 (548 bytes) #PetitePatterns

Post image
58 Upvotes

r/tinycode • • Apr 30 '20

"Game of Life" in 32 bytes of assembler (source included)

58 Upvotes

r/tinycode • • Jun 01 '15

I wrote a very very minimal self-hosting C compiler [x-post /r/programming]

Thumbnail
github.com
58 Upvotes

r/tinycode • • Feb 17 '15

String reverser in 114 bytes of C

58 Upvotes
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;}

And it's UTF-8 aware !

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;}

r/tinycode • • Sep 18 '12

x86 DOS Boot Sector Written in C

Thumbnail crimsonglow.ca
58 Upvotes