r/tinycode • u/r-lyeh • Apr 11 '13
r/tinycode • u/Hashiota • Oct 27 '12
Tiny interpreter produced "on one page and in one afternoon" that inspired a serious implementation of the J programming language.
nsl.comr/tinycode • u/juanmar0driguez • Mar 13 '22
Processing code, f changes figure and u changes size (if you play with coss and sins you get everything after 4th img): float t=0; int f=16; int u=200; void setup(){size(u*2,u*2);background(0);}void draw(){if(t<=4*PI){line(u+cos(t*f)*u*2,u+sin(t*f)*u*2,u+cos(t)*u,u+sin(t)*u);t+=f/1000;}}
r/tinycode • u/sablal • May 26 '20
Tiny file manager nnn adds previews, find & list, persistent session and much more
r/tinycode • u/soveran • Mar 14 '18
Map is hopefully an improvement upon the ergonomics of tools like xargs, find -exec and shell for-loops
r/tinycode • u/[deleted] • Mar 01 '16
SHA-3 optimized for size in x86 assembly.
r/tinycode • u/FUZxxl • Jan 01 '16
Mecrisp: An optimizing Forth compiler in 11 kB code running with less than 512 B of RAM.
mecrisp.sourceforge.netr/tinycode • u/nexe • Apr 01 '14
2048 game in concise but not golfed Ruby
r/tinycode • u/[deleted] • Mar 23 '14
198 byte ASCII Madelbrot render
Taken from here.
var a="";for(Im=-1.2;1.2>=Im;Im+=0.05){for(Re=-2;1>=Re;Re+=0.03){for(var b=Re,c=Im,d=0;16>d;d++){var e=b*b,f=c*c;if(4<e+f)break;c=2*b*c+Im;b=e-f+Re}a+=" .,:;=|iI+hHOE#$-".charAt(d)}console.log(a);a=""};edit - 196-byte, actually
r/tinycode • u/rxi • Oct 30 '13
A tiny dynamic array implementation using C's preprocessor
codepad.orgr/tinycode • u/[deleted] • May 14 '13
Javascript Prime Sieve up to 100k in 83 chars
You can paste the following in to your JS console if you're using Chrome:
x=1e5;c=[];for(s=2;s<x;s++)if(!c[s])for(i=s+s,document.write(s+' ');i<x;i+=s)c[i]=1Or alternatively view it on Codepen with some unnecessary CSS here. Codepen apparently renders some garbage above the output on Firefox.
83 characters is begging to be squeezed in to an 80 character line, but I think it would take a pretty significant restructuring to shrink it further.
r/tinycode • u/Rotten194 • Jul 25 '12
How About a Challenge #4: Find the longest common substrings between two strings!
Now is that time of the week, the time where /r/tinycode has a challenge where you can win fabulous prizes flair!
Previous challenges:
[#3 - Perfect Numbers] (http://www.reddit.com/r/tinycode/comments/wpsjv/how_about_a_challenge_3_find_the_perfect_numbers/)
The challenge for this is to find the common substrings between two strings. You should return a list of the longest substrings.
For example:
aaabbbbccc aabccdcdd -> aab, bcc
adeaabbbbccc aabccdedcdd -> aab, bcc
abcdef ghijk -> nothing
abcdef fghijk -> f
Notice in number 2, 'de' was also a substring, but was shorter than 3 so wasn't returned.
Rules:
Your program must take both strings on the command line
Your program can't use external libraries or download code. I made an exception in an earlier competition about external libraries, but I feel this is simple enough that they shouldn't be needed for any major language.
Here is some example code. Before simply mindlessly golfing this, try and write some elegant code in a different way, then golf that. This isn't necessarily the shortest solution.
import sys
def permutations(s):
l = []
for i in range(len(s)):
for j in range(len(s)):
l.append(s[i:j+1])
return l
def substrings(a, b):
l = filter(lambda s: s in a,permutations(b))
longest = reduce(lambda i, s: len(s) if len(s) > i else i, l, 0)
longest = longest if longest > 0 else -1
return filter(lambda s: len(s) == longest, l)
print substrings(sys.argv[1], sys.argv[2])r/tinycode • u/cndpoint • Nov 19 '23
I released a 19-track algorithmic music album, written in x86 assembly language, where each song is roughly 128 bytes
r/tinycode • u/rain5 • Oct 02 '21
vec2 p,q,S=vec2(-24,31),v,w=FC.xy;L(p)L(q)v+=p*dot(C((p+q).yx*S+w),q);o1.zx=(C(v+w))*vec2(.997,1.002)+.02/(w-3.);o0=abs(cos(vec4(1,2,3,4)-length(o1)*9.));
r/tinycode • u/vgrichina • Sep 23 '20
Unit testing framework in 3 lines of C code
jera.comr/tinycode • u/Hell__Mood • Sep 19 '20
Rainy window effect with sound in 32 bytes
r/tinycode • u/nanochess • Jul 29 '19