Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 815

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

3 votes

Shortest Floor Function

C (80) Well it's not the shortest, but it's a great opportunity to show off my bit twiddling skills :D. main(){int I,X=0x7FFFFF;scanf("%f",&I);printf("%d",((I&X)|X+1)>>-(I>>23)+150);}
1 vote

I'm walking around manhattan, how far am I from my hotel?

Matlab, 51 characters My Matlab submission, works only with captial letters. This was a fun one! The hardest part was converting the string into an array of complex numbers to be summed. Function: …
Hannesh's user avatar
  • 1,235
1 vote

Construct a polynomial with given roots

Javascript, 121 bytes r=>{o=[...r,0].fill(0);for(i=2**r.length;i--;)e=r.length,a=r.reduce((a,q,j)=>a*(i&1<<j?q:(e--,-1)),1),o[e]+=a;return o;} Explantation Similar to other answers, we imagine a poly …
Hannesh's user avatar
  • 1,235
12 votes
6 answers
959 views

ASCII-art polygons to GeoJSON coordinates

We're going to turn ascii art versions of polygons into their equivalent GeoJSON. The ASCII shape language The input ASCII language only has 3 possible characters: * signifies a vertex - signifies a …
Hannesh's user avatar
  • 1,235
53 votes
31 answers
11k views

Generate a mandelbrot fractal [closed]

Your task is to draw the mandelbrot set in ascii. It should look something like The complex number c lies in the mandelbrot set, when the sequence z(n+1) = z(n)^2 + c, z(0) = 0 remains bounded. For …
Hannesh's user avatar
  • 1,235
2 votes

The Caged Circles

Javascript, 199 bytes My first code golf in a long time! I originally started with a brute force solution, but couldn't get the step sizes small enough to have it produce the correct answers in a time …
Hannesh's user avatar
  • 1,235
1 vote

Determine whether strings are anagrams

Matlab (24) Given two strings a and b. isequal(sort(a),sort(b))
Hannesh's user avatar
  • 1,235
10 votes
2 answers
1k views

Floating point addition, without floats!

Your task is to write a program, in any language, that adds two floating point numbers together WITHOUT using any fractional or floating point maths. Integer maths is allowed. Format The format for …
Hannesh's user avatar
  • 1,235
3 votes

Collatz's ice cream cone factory

HTML + JS, 166 bytes JS: 156 bytes HTML: 14 bytes This is a pretty basic implementation that renders to the DOM using an HTML canvas. A good chunk of the code is spent scaling the output to fit within …
Hannesh's user avatar
  • 1,235