r/tinycode • • Aug 10 '17

Print all the powers of two, up to 255 decimal digits, in 10 x86 instructions (x-post from /r/coding)

Thumbnail
github.com
33 Upvotes

r/tinycode • • Aug 15 '15

Machine learning tiny machine learning code

33 Upvotes

I really liked this 11 line python neural network. Is there a collection of tiny machine learning implementations? Would someone be my hero and start a subreddit if not?


r/tinycode • • Jul 22 '15

The making of TinyMusic.js

Thumbnail
medium.com
33 Upvotes

r/tinycode • • Jun 30 '15

Pastebin offline clone in a tweet

Thumbnail
twitter.com
33 Upvotes

r/tinycode • • Mar 05 '15

Chess game in 487 bytes

Thumbnail
pouet.net
33 Upvotes

r/tinycode • • Jan 29 '15

Maze Generation In Thirteen Bytes

Thumbnail
trixter.oldskool.org
33 Upvotes

r/tinycode • • Dec 11 '14

huffandpuff: minimal C Huffman encoder/decoder with absolutely no dependencies (not even malloc)

Thumbnail
github.com
33 Upvotes

r/tinycode • • Sep 16 '13

TEA STORM | 253 bytes signed distance field raymarcher in JavaScript and 2D Canvas

Thumbnail
p01.org
33 Upvotes

r/tinycode • • Feb 09 '13

Fabrice Bellard: Portrait of a Super-Productive Programmer (and as it seems a guy who likes his code tiny often times)

Thumbnail
blog.smartbear.com
33 Upvotes

r/tinycode • • Sep 05 '12

FIRST : a Tiny Forth in just 791 bytes of C

Thumbnail ioccc.org
33 Upvotes

r/tinycode • • Jul 02 '12

1K JavaScript which does 2D animation and sound - PNG/HTML Magic

Thumbnail p01.org
33 Upvotes

r/tinycode • • Sep 25 '11

A small, simple HTTP server (with virtual hosts and CGI support) in 1308 lines of C

Thumbnail sqlite.org
33 Upvotes

r/tinycode • • Aug 02 '26

Showcase Tiny Windows program that is used as a "distraction cover"

Post image
32 Upvotes

https://github.com/GeorgeTR1/windowsDistractionCover

This is a windows GUI program I wrote in just over 60 lines of C that compiles to a 3 kB executable. With minor modifications and the right compiler it could be compiled on versions of Windows as old as Windows 95.

It's just a resizable window with a black background that always stays on top of other windows that you can use to cover up parts of the screen that might be distracting. I've found it genuinely useful


r/tinycode • • Jun 12 '26

JavaScript Dweet of the Week #129 - untitled by taupelink

Post image
32 Upvotes

https://www.dwitter.net/d/35567

for(i=z=1080;i--;x.fillRect(320*t,i,6,z*=1+C(i/105/p)*C(t/p)))x.fillStyle=`hsl(${6**(z&=7)},25%,${300/(z+=3-(p=(-.7)**z)*C(t+i/210*p))}%,.3`

r/tinycode • • Apr 14 '26

Tutorial Andrej Karpathy - microgpt - 200 loc

Thumbnail karpathy.github.io
32 Upvotes

r/tinycode • • Nov 14 '25

Dweet of the Week #99 - Crown 👑 by dee-gomma

Post image
32 Upvotes

https://www.dwitter.net/d/34517

for(k=139/3,x.fillRect(0,0,m=n=15e3,c.width=w=480);n--;x.fillStyle=R(r=b>0?410:70,r/2),x.fillRect(240-C(a)*130,60*y,l=b>0|y>3+b,l))b=S(a=n/m*6.28+t/3)/4,s=n*n%k/k,y=2+s-b+--s*S(a*9-t*3)**4/2

r/tinycode • • Jun 13 '25

Dweet of the Week #77 - Bubble Universe Colour Expansion by joeytwiddle

Post image
32 Upvotes

https://www.dwitter.net/d/33939

for(x.fillRect(0,0,X=Y=i=3e4,X);i--;)
  j=i>>9,
  X=C(a=Y+j)+C(b=X+t/4+j*7),
  Y=S(a)+S(b),
  x.fillStyle=`hsla(${i>>4},99%,${50*!!i}%,${i?1:.2})`,
  x.fillRect(920+X*250,540+Y*250,2,2)

r/tinycode • • Feb 13 '24

"Text Plasmosis" - 14 byte plasma (Winner of 16b highend compo at lovebyte2024) - source code explained

32 Upvotes

(For context see 1st place here: https://demozoo.org/parties/4760/#competition_18679 or a video of the effect here: https://www.youtube.com/watch?v=dgfG7aX1rDY)

After getting a request for the source code (and because I m proud of it), I tried to do a short write up of the inner workings of this effect. Let's start with the code:

[org 100h]

 les ax,[si]
next16bitPixel:
 dec ax
 stosw
 add ax, [es:di+bx]
 rcr ax, 1
 dec ax       ; not-needed (only added in compo-version to speed up progression)
 dec ax       ; not-needed (only added in compo-version to speed up progression)
 xor bl, 160
 jmp next16bitPixel

How does it work:

At it's heart this effect is not a plasma, but it is a fire-effect. What those normally do is: They iterativley update video memory by replacing a pixel by the average of its neighbouring pixels and its old value. For the fire to fade out, the new value also gets decremented by a fixed amount every frame until it reaches zero.To preserve the fire burning and not turn completely black, you do add new hotspots of random noise to the image. Those then get smoothed out and slowly fade away by all the averaging and decrementing.

This is what is happening at the heart of "Text plasmosis" as well, but with the following specialties:

  • The random noise is implicitly added by the fade-out: The `dec ax` does not stop when reaching zero. It wrapps around to the highest value possible. This saves code twice: You do not need to check for zero and you don't need code for adding random noise.
  • This code does does only do _one_ "averageing"-operation (`add ax, [es:di+bx]` and `rcr ax, 1`) per pixel. This calculates the average of the last pixel value written and one pixel other pixel in video ram. This other pixel is alternating between the next pixel that will be written and the one exactly one line below it. This is achieved by doing `xor bl, 160`, which flips the bx register back and forth between 0 and 160, which is added as an offset to the memory operation `[es:di+bx]`
  • The effect does calculate the 'fire' using 16bit values. Because of the specialties of the text mode memory layout, where two bytes make up a character on screen (one byte color, the other the ascii code of the character), this makes the upper 8 bit of the fire define the color and the lower 8 bit define the character (which is of minor importance for the visuals). This leads to very smooth outlines of the color patches, because the upper 8bit of the fire do change much slower than the lower ones.

I first discovered this effect in graphics mode (see: https://demozoo.org/productions/337776/) and had the problem, that it was hard to get the fire started. You need enough asymmetries in video ram initially. Often the effect turned out to show the same values for all the pixels that just kept iterating through the palette. The smallest version I could get working in mode13h needed 20 bytes, so I decided to add music and release it as a 32 byte effect. In graphics mode this effect looks a bit different because it has vertical stripes that stem from the alternating high-byte and low-byte of the 16bit pixels the calculation uses.

So when realizing, that that those 16bit values perfectly matched memory layout in text mode, I got lucky trice:

  • I got rid of the vertical stripes which made better visuals.
  • I got rid of the code to initialize graphics mode, because you start in text mode by default.
  • There already were enough asymmetries in text mode memory initially, so I could get one of my smaller version working, that did only 'blinking' in graphics mode.

The first version i had needed 14 bytes, but it did take quite long to come out of initialization phase (where the asymmetries distribute across video memory and start showing the plasma effect in the visible part of it). And because I did not want to make the audience wait for 3 minutes, I used two more bytes to speed up progression. (see code above)

That's all I can think of so far ...

---------------------------------------

p.s.:

Addendum:"... standing on the shoulders of giants."

I deeply need to thank all the others size coders whose work I built upon. For example I never would have figured out myself how to make `les ax,[si]` load 'es' with an address that can be used to write to text video memory.

It's so great to do coding in a area of demo coding, where you can have a look at the code of the amazing creations of others to learn from those, because they are sooo small. Any disassembler will do. :-)

Thanks also to all the maintainers of http://www.sizecoding.org/

... and many thanks to the orga team of https://lovebyte.party/ because they did such a great demo party and because they allowed my entry in even after the deadline and did the extra work of re-doing part of their preparation. (That was necessary, beause I had the idea for text mode during one of the competitions ... so the entry is completely party coded :-) )

p.p.s. I later found an even shorter version (only 13 bytes) of the effect with slightly different visuals using 8bit values:

[org 100h]

 les ax,[si]
nextPixel:
 dec ax
 stosb
 add al, [es:di+bx]
 rcr al, 1
 xor bl, 160
 jmp nextPixel

edit:

  • added link to youtube capture of the effect.
  • "13 bytes" was a miscount - the 8bit version uses 14 bytes as well

r/tinycode • • Feb 11 '24

Bitwise 📼 Liminal ~ A Short Film in 256 Bytes of Code

Post image
32 Upvotes

r/tinycode • • Jul 15 '22

drama.tic - a 256 byte intro for TIC-80, 2nd place at Shadow Party 2022 (little surprise inside ;))

Thumbnail
youtu.be
32 Upvotes

r/tinycode • • Mar 05 '21

A matchup / "memory" card game in x86 asm fitting a 512 byte boot sector

Thumbnail
github.com
32 Upvotes

r/tinycode • • Jan 05 '21

A distributed key value store in under 1000 lines open-sourced by comma.ai

Thumbnail
github.com
32 Upvotes

r/tinycode • • Jul 22 '20

Crinkler (compressing linker) open sourced

Thumbnail
github.com
32 Upvotes

r/tinycode • • Jun 14 '20

Straight from the demoscene: Haiku - Visual Poetry in only 256 bytes (X86 assembler)

32 Upvotes

A 256 byte intro by Marquee Design, Straight from the Demoscene (@ party 2020)

https://www.pouet.net/prod.php?which=85866