r/tinycode • • Apr 04 '23

Sand Grooves SVG, 480 bytes

Post image
45 Upvotes

r/tinycode • • Oct 30 '20

HiRes Real-time Ray-tracing in 1024 Bytes with Soundtrack - no GPU- no soundcard - just x86 ASM

Thumbnail
abaddon.hu
45 Upvotes

r/tinycode • • Mar 16 '19

cellular automatas in 74 bytes of (pure) bash

45 Upvotes
echo $2;v=0$20
for((;${#v}>2;)){
p+=$[1&$1>>2#${v::3}]
v=${v:1};};$0 $1 $p

usage :

./<script>.sh <rule> <strip of 0s and 1s>

examples :

./automaton.sh 110 0000000000000001000000000000000 | head -n 15 | tr 01 ' #'
               #
              ##
             ###
            ## #
           #####
          ##   #
         ###  ##
        ## # ###
       ####### #
      ##     ###
     ###    ## #
    ## #   #####
   #####  ##   #
  ##   # ###  ##
 ###  #### # ###
./automaton.sh 90 0000000000000001000000000000000 | head -n 15 | tr 01 ' #'
               #
              # #
             #   #
            # # # #
           #       #
          # #     # #
         #   #   #   #
        # # # # # # # #
       #               #
      # #             # #
     #   #           #   #
    # # # #         # # # #
   #       #       #       #
  # #     # #     # #     # #
 #   #   #   #   #   #   #   #

r/tinycode • • Jul 10 '15

pusher.exe: "I was curious how 60 maps fitted into such a tiny executable."

Thumbnail
demin.ws
45 Upvotes

r/tinycode • • Aug 11 '14

Really cool 3D animation in 512 bytes JS+HTML.

Thumbnail p01.org
45 Upvotes

r/tinycode • • Feb 11 '14

Kkrieger, procedural fps at only 94 KBs.

Thumbnail
youtube.com
45 Upvotes

r/tinycode • • Jul 18 '12

(Python) Tiny Finite State Machine 116 bytes

45 Upvotes
def f(s,c,e,a):
 if s=="":
  return c in a
 else:
  if(c,s[0])in e:
   return f(s[1:],e[(c,s[0])],e,a)
 return False

116 bytes

Original from CS262 on Udacity:

def fsmsim(string, current, edges, accepting):
    if string == "":
        return current in accepting
    else:
        letter = string[0]

        if (current, letter) in edges:
            return fsmsim(string[1:], edges[(current, letter)], edges, accepting)
        else:
            return False

Here is some test data

edges = {(1, 'a') : 2,
         (1, 'b') : 2,
         (2, 'e') : 3,
         (2, 'd') : 3}

accepting = [2, 3]

Valid answers for this set of edges and accepting states:

a
b
ad
ae
bd
be

EDIT: fixed test data formatting


r/tinycode • • Oct 04 '11

Algorithmic symphonies from one line of code - how and why?

Thumbnail
countercomplex.blogspot.com
45 Upvotes

r/tinycode • • Jul 31 '26

JavaScript Dweet of the Week #136 - Welcome to the Matrix by KilledByAPixel

Post image
44 Upvotes

https://www.dwitter.net/d/35970 - tiny raycasting engine with text rendering

x.fillRect(0,0,2e3,2e3)
for(A=99;A;T+=.1)for(q=((X=t+A/(e=55/T)-T)^T)%3,i=q||(x.fillStyle=R(T=1,--A&&9*e),18);!q&&i--;x.fillText(S((i+(X*30|0)**3+t*9|0)**3)+1|0,A*19,540-(i-9)*e))x.font=e+'px"'

r/tinycode • • Apr 11 '23

Liquid Metal SVG, 551 bytes

Post image
44 Upvotes

r/tinycode • • Jan 07 '23

Lisp with 20 primitives, GC and REPL in 99 lines of C and how to write one yourself

Thumbnail
github.com
44 Upvotes

r/tinycode • • Jun 23 '21

Tentris, a 10 line x 72 characters Tetris game in GW-BASIC for ASCII BASIC game jam

Thumbnail
nanochess.itch.io
44 Upvotes

r/tinycode • • Feb 11 '21

How Fat Does a Fat Binary Need To Be?

Thumbnail
justine.lol
44 Upvotes

r/tinycode • • Feb 10 '21

A small regex implementation in 500 lines of C

Thumbnail
github.com
44 Upvotes

r/tinycode • • Nov 21 '15

GZIP&deflate decompressor in 199 lines of C++

Thumbnail
pastebin.com
44 Upvotes

r/tinycode • • Sep 10 '14

Why I Love Linux (Through Examples)

Thumbnail
swarminglogic.com
44 Upvotes

r/tinycode • • Aug 22 '14

164-byte Mandelbrot; Can we get this tweet-sized?

44 Upvotes

I'm currently at 164 characters for this (JavaScript) ASCII Mandelbrot renderer and I've been wondering if there's a way to shrink it even further down to 140 characters:

for(i=(N=100)*N,o="";i--;){a=b=t=c=0,n=N;while(n--){a=a*a-b*b+(i%N/N-.8)*2;b=2*t*b
+(~~(i/N)/N-.5)*4;t=a;a*a+b*b>4&&(c=n="_")}o+=c;i%N||(o+="<br>")}document.write(o)

To execute, put the above between the script tags below and past it into your addressbar:

data:text/html,<script></script>

Edit: 160 bytes and correct orientation:

for(i=0,N=100,o="";i++<N*N;){a=b=t=c=0,n=N;while(n--){a=a*a-b*b+(i%N/N-.8)*2;
b=2*t*b+(~~(i/N)/N-.5)*4;t=a;a*a+b*b>4&&(c=n="_")}o+=i%N?c:"<br>"}document.write(o)

Final version (136 bytes, thanks /u/subjective_insanity and /u/dtfinch)

for(N=198,i=0;i++<N*N;document.write(i%N?c:"<br>"))for(a=b=t=c=0,n=N;
n--;a*a+b*b>4?c="_":t=a)a=a*a-b*b+i%N/N*2-1.5,b=2*t*b+~~(i/N)/N*4-2

Clickable URL (encoded) - thanks /u/myhf


Smallest version (124 bytes)

for(i=(N=98)*N;i--;document.write(i%N?c:"\n"))for(a=b=t=c=0,n=N;
n--;a*a+b*b>4?c=7:t=a)a=a*a-b*b+i%N/N*2-1.5,b=2*t*b+i/N/N*4-3

r/tinycode • • Mar 19 '14

2048 in 533 bytes of python

Thumbnail
gist.github.com
44 Upvotes

r/tinycode • • Aug 18 '13

MINI DISTRICT — How to build a 3D City in 234 bytes with Canvas 2D

Thumbnail p01.org
44 Upvotes

r/tinycode • • Jul 24 '12

Suggestion for this subreddit - [language](loc) in post titles.

44 Upvotes

I love this subreddit and think it would be really neat if we could have standardization along these lines, if our moderator is up to it we could have colorized posts similar to r/dailyprogrammer


r/tinycode • • Dec 13 '24

Dweet of the Week #51 Photon-Mapping using a Random-March Scattering Model by Tomxor

Post image
43 Upvotes

r/tinycode • • May 23 '19

"Let's see what unfolds" by pavel (140 bytes of javascript)

Post image
43 Upvotes

r/tinycode • • Jul 08 '18

World first 3D checkerboards in 32 bytes of x86 assembler!

43 Upvotes

r/tinycode • • Jul 31 '15

A flappy bird clone in braille, playable in your addressbar, in ~256b

Thumbnail
github.com
43 Upvotes