268
votes
Draw the national flag of Iceland
Python 3, 190 172 171 169 167 160 159 147 143 bytes
Using PIL version 1.1.7 which has a deprecated but not removed offset method.
...
120
votes
Draw the national flag of Iceland
x86 real-mode machine code for DOS COM, 69 65 63 62 bytes
The code is meant to be executed as a DOS COM executable.
Special thanks
meden, saved four bytes.
meden, saved two bytes and removed the ...
115
votes
77
votes
Draw the national flag of France
Pure Bash (on OSX), 84
The default OSX terminal supports full colour emojis. Not sure if this counts as text or graphical output.
...
58
votes
Appease Your Google Overlords: Draw the "G" Logo
Mathematica, 229 226 225 224 221 206 169 bytes
Thanks @MartinEnder for 1 byte, @ChipHurst for 37 bytes!
...
57
votes
57
votes
Triangular Lattice Points close to the Origin
Python 2, 43 bytes
f=lambda n,a=1:n*n<a/3or n*n/a*6-f(n,a+a%3)
Try it online!
This is black magic.
Offering 250 rep for a written-up proof. See Lynn's ...
56
votes
Evaluate the aspect ratio of a triangle
Jelly, 7 bytes
SH_÷@HP
Try it online!
Explanation
Let’s read this chain:
The implicit argument is a list [a, b, c].
First ...
54
votes
Draw the national flag of France
Desmos, 30 12 bytes
3x>10
3x<-10
Try it online.
I'm not entirely sure if this is valid, please let me know if there are any issues.
45
votes
Accepted
Sprocket Science: Animating a Chain Drive System
JavaScript (ES6), 2557 1915 1897 1681 bytes
This isn't super-duper golfed really; it's minified - partly by hand - but that's nothing special. It could no doubt be shorter if I'd golfed it more ...
45
votes
45
votes
Construct a pentagon avoiding compass use
2 circles, 13 lines, 17 points
Try it on GeoGebra
Let circle(A, B) intersect circle(B, A) at C and D.
Let AB intersect circle(A, B) again at E.
Let AB intersect circle(B, A) again at F.
Let AD ...
43
votes
Draw the national flag of France
HTML / SVG, 76 bytes 87 88 121 122 149
Saved 27 bytes thanks to @insertusernamehere
Saves 9 bytes thanks to @Joey
Saved 1 bytes thanks to @sanchies
Saves 1 bytes thanks to @Neil
...
43
votes
Random point on a sphere
Wolfram Language (Mathematica), 20 bytes
RandomPoint@Sphere[]
Try it online!
Does exactly what it says on the tin.
41
votes
Sprocket Science: Animating a Chain Drive System
C# 3566 bytes
Not golfed at all, but works (I think)
Ungolfed in edit history.
Uses Magick.NET to render gif.
...
41
votes
38
votes
Accepted
Draw the national flag of France
CJam, 23 22 bytes
00000000: 27 9b 22 5c 22 25 1f 22 66 7b 69 27 6d 32 37 2a '."\"%."f{i'm27*
00000010: 7d 4e 5d 32 36 2a }N]26*
...
38
votes
Is my triangle right?
Jelly, 5 bytes
²µSHe
Try it online!
Technical note: Bytes are counted in Jelly codepage.
Explanation:
...
36
votes
35
votes
Appease Your Google Overlords: Draw the "G" Logo
Python 2, 244 220 bytes
using Martin Rosenau's transformation on the [-1,1]^2 plane and minor golfing like removing 0. or brackets
...
35
votes
Covering a Skyline with brush strokes
JavaScript (Node.js), 38 bytes
a=>a.map(v=>(n+=v>p&&v-p,p=v),p=n=0)|n
Try it online!
Simply a greedy algorithm which scan from left to right, ...
34
votes
Solve Grid-Tangram
BBC BASIC, 570 514 490 bytes ASCII
Download interpreter at http://www.bbcbasic.co.uk/bbcwin/download.html
435 bytes tokenised
Full program displays an input from ...
34
votes
Triangular Lattice Points close to the Origin
Haskell, 48 bytes
f n=1+6*sum[(mod(i+1)3-1)*div(n^2)i|i<-[1..n^2]]
Try it online!
Uses xnor's "black magic" formula:
$$f(n)=1+6\sum_{a=0}^\infty \...
32
votes
Draw the national flag of Iceland
Excel VBA, 254 228 153 bytes
Couldn't really find a way to set column/row size to pixels(thereby making them square) because of the way Excel handles it so make them nice and square first.
Edit 1: ...
31
votes
Covering a Skyline with brush strokes
05AB1E, 8 7 5 bytes
Saved 2 bytes thanks to @Adnan
0š¥þO
Try it online!
How?
This is using the algorithm that was first found by @tsh. If you like this answer, ...
30
votes
30
votes
Triangular Lattice Points close to the Origin
Wolfram Language (Mathematica), 53 51 50 bytes
-1 byte thanks to @miles
Sum[Boole[x(x+y)+y^2<=#^2],{x,-2#,2#},{y,-2#,2#}]&
Try it online!
How?
Instead of ...
29
votes
29
votes
Draw the national flag of Iceland
MATL, 57 56 52 49 48 bytes
7:g2IvtPvt!9Mh2$X>2YG[0E28]8*255/7B[43DD]51/v2ZG
This produces the following figure (tested with the compiler running on Matlab and ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
geometry × 370code-golf × 336
math × 121
graphical-output × 44
grid × 40
ascii-art × 35
combinatorics × 23
decision-problem × 20
sequence × 19
code-challenge × 17
kolmogorov-complexity × 16
string × 13
arithmetic × 12
number × 11
trigonometry × 11
3d × 10
array × 10
integer × 9
random × 8
abstract-algebra × 8
popularity-contest × 7
image-processing × 7
tiling × 7
polyomino × 7
fastest-code × 6