259

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. from PIL.ImageDraw import* i=Image.new('RGB',(25,18),'#d72828') Draw(i).rectangle((1,1,23,16),'#0048e0',~0) i.offset(9).resize((100,72)).show() Creates a 25*18 pixel image filled with red then draws a 23*16 pixel rectangle ...


117

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 flickering. Machine code (in hex bytes) 68 00 A0 07 B8 13 00 CD 10 BE 23 01 AD 91 AD 91 AC E3 FE 60 30 ED F3 AA 61 81 C7 40 01 FE CD 75 F2 EB E9 ...


112

Python + scipy + scikit-image, weighted Poisson disc sampling My solution is rather complex. I do some preprocessing on the image to remove noise and get a mapping how 'interesting' each point is (using a combination of local entropy and edge detection): Then I choose sampling points using Poisson disc sampling with a twist: the distance of the circle is ...


108

Taxi, 7394 3773 bytes Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Tom's Trims.Pickup a passenger going to Tom's Trims.Go to Tom's Trims:n.[a]Pickup a passenger going to The Babelfishery.Go to The Babelfishery:s 1 l 1 r.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l 1 l 2 r.Pickup a passenger going to Addition Alley.Pickup a ...


82

Penrose rhombii in Python, +97 points I chose a penrose tiling composed of two different shaped rhombuses, meeting 3-8 per vertex. This penrose tiling is proven aperiodic elsewhere. The simulation is graphical (via pygame) and interactive. Comments indicate two places in the code where algorithm implementation was taken from another source. There are many ...


75

Pure Bash (on OSX), 84 The default OSX terminal supports full colour emojis. Not sure if this counts as text or graphical output. printf -vs %26s for i in {1..26} do echo ${s// /🔵}${s// /⚪️}${s// /🔴} done Output looks like: Alternatively: Bash with OSX utilities, 56 yes `dc -e3do26^d1-dn2/*p|tr 201 🔵🔴⚪️`|sed 26q The dc expression: calculates 3^...


65

C++ My approach is quite slow, but I'm very happy with quality of the results that it gives, particularly with respect to preserving edges. For example, here's Yoshi and the Cornell Box with just 1000 sites each: There are two main parts that make it tick. The first, embodied in the evaluate() function takes a set of candidate site locations, sets the ...


56

Jelly, 7 bytes SH_÷@HP Try it online! Explanation Let’s read this chain: The implicit argument is a list [a, b, c]. First we read S. This takes the sum: a + b + c. Then, we read H. This halves it: (a + b + c)/2. (This is s.) Then, we read a dyad _ (subtract), followed by another dyad. This is a hook: it lacks a right argument, so it receives the ...


55

IDL, adaptive refinement This method is inspired by Adaptive Mesh Refinement from astronomical simulations, and also Subdivision surface. This is the kind of task that IDL prides itself on, which you'll be able to tell by the large number of builtin functions I was able to use. :D I've output some of the intermediates for the black-background yoshi test ...


55

C, 194 191 183 Bytes #define C "\x1b[" #define A "@@@@@@" y;f(){for(;y++<14;)printf(y>5&&y<10?y>6&&y<9?C"31m"A A A A"@\n":C"0m"A"@@"C"31m@@"C"0m"A A"@@@\n":C"34m"A"@"C"0m@"C"31m@@"C"0m@"C"34m"A A"@@\n");} -3 adding one @ on the #define A -8 adding [ on #define C Usage main(){f();} Output valid basing on this comment from ...


55

Mathematica, 229 226 225 224 221 206 169 bytes Thanks @MartinEnder for 1 byte, @ChipHurst for 37 bytes! Graphics[{RGBColor@{"#EA4335","#FBBC05","#34A853","#4285F4"}[[#]],{0,-1}~Cuboid~{√24,1},Annulus[0{,},{3,5},{(2#-9)Pi/4,ArcCsc@5}]}&~Array~4,ImageSize->#,PlotRange->5]& What a fun challenge! Explanation ...&~Array~4 Iterate from 1 to ...


51

Python 2, 47 bytes s="[3%smF";print(s%4*26+s%7*26+s%1*26+"\n")*30 Contains unprintables - here's a hexdump (reversible with xxd -r): 00000000: 733d 221b 5b33 2573 3b31 6d46 223b 7072 s=".[3%s;1mF";pr 00000010: 696e 7428 7325 342a 3236 2b73 2537 2a32 int(s%4*26+s%7*2 00000020: 362b 7325 312a 3236 2b22 5c6e 2229 2a33 6+s%1*26+"\n")*3 00000030: 30 ...


51

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.


50

Mathematica, 193 183 177 173 169 166 bytes Yay, maths! I'm plotting the region that satisfies a certain (rather complicated) set of inequalities: e=RegionPlot[(1<Abs@y<3||c)&&{x,y+12}.(d=2{-5Sin@40°-6,m=5Cos@40°})*{x+15,y+1-2Sign@y}.d<0||c&&x<2m/.c->100<x^2+y^2<144,{x,-15,9},{y,-12,12},Frame->0>1,ImageSize->#]&...


49

C++ w/ OpenGL (+17) So I tried 3-Isohedral convex pentagon grid. Works for me ;) Standard game of life rules apply, except the grid is not infinite - there are border cells outside the image. 30% of the cells are initially alive. This is how the grid looks like: The live version: Blue cells are alive, white are dead. Red cells just died, green were just ...


49

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 answer for a proof and explanation.


47

Python 3 + PIL + SciPy, Fuzzy k-means from collections import defaultdict import itertools import random import time from PIL import Image import numpy as np from scipy.spatial import KDTree, Delaunay INFILE = "planet.jpg" OUTFILE = "voronoi.txt" N = 3000 DEBUG = True # Outputs extra images to see what's happening FEATURE_FILE = "features.png" ...


44

Python + Pycairo, 371 370 366 bytes from cairo import* p=3.141593 c=Context(SVGSurface("F",12,8)) C=c.set_source_rgb;R=c.rectangle;T=c.rotate;F=c.fill C(1,1,1);R(0,0,12,8);F() c.translate(6,4);T(.588);b=3188 for o in[(0,.2,.47),(.77,.05,.19)]*2:C(*o);i=b/2%2;b+=1;c.arc(i,0,2-i,0,p+i*p);F();T(p) C(0,0,0) for x in(p,1.966)*2: for y in.5,0,1: for z in-1,1:...


44

Python 2, 323 319 bytes exec u"def I(s,a,b=1j):c,d=s;d-=c;c-=a;e=(d*bX;return e*(0<=(b*cX*e<=e*e)and[a+(d*cX*b/e]or[]\nE=lambda p:zip(p,p[1:]+p);S=sorted;P=E(input());print sum((t-b)*(r-l)/2Fl,r@E(S(i.realFa,b@PFe@PFi@I(e,a,b-a)))[:-1]Fb,t@E(S(((i+j)XFe@PFi@I(e,l)Fj@I(e,r)))[::2])".translate({70:u" for ",64:u" in ",88:u".conjugate()).imag"}) Takes a ...


44

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 <svg><path fill=#0055a4 d=m0,0h26v52H0 /><path fill=#ef4135 d=M52,0h26v52H52 Using lots of HTML syntax abuse, this can get pretty short. Screenshot of output: ...


44

C (Windows), 311 bytes #include <windows.h> main(int c,char**v){float x,y,a,b,N=atoi(*++v);HDC d=GetDC(GetDesktopWindow());for(x=0;x<N;x+=1)for(y=0;y<N;y+=1){a=2*x/N-1;b=2*y/N-1;SetPixel(d,x,y,(a>0&&a<.8&&b*b<.04)?0xF48542:(a*a+b*b>1||a*a+b*b<.36)?0xFFFFFF:(a*a<b*b)?((b<0)?3490794:5482548):(a<0)?376059:(b&...


42

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 before minifying, but I've spent (more than) enough time on this already. Edit: Ok, so I spent more time on it and golfed the code more before minifying (very ...


40

C# 3566 bytes Not golfed at all, but works (I think) Ungolfed in edit history. Uses Magick.NET to render gif. class S{public float x,y,r;public bool c;public double i,o,a=0,l=0;public S(float X,float Y,float R){x=X;y=Y;r=R;}}class P{List<S>q=new List<S>();float x=float.MaxValue,X=float.MinValue,y=float.MaxValue,Y=float.MinValue,z=0,Z=0,N;int ...


38

Go, ? points So rather than pin myself down to a particular tiling, I wrote a program that takes a gif or png of a tiling and runs life on it. The gif/png must use a single color for all the tiles. package main import ( "flag" "image" "image/color" "image/gif" "image/png" "math/rand" "os" "strings" ) func main() { ...


38

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* The above is a hexdump that can be reversed with xxd -r. At the cost of two extra bytes – for a total of 24 bytes – we can use background colors instead, making the output a bit ...


37

Jelly, 5 bytes ²µSHe Try it online! Technical note: Bytes are counted in Jelly codepage. Explanation: ²µSHe Main link. ² Square each number. µ With the new list, S calculate its sum, H and halve it. e Check if the result exists in the new list (squared input) The problem is equivalent to being given three numbers a, b, c, and ...


37

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 intersect circle(A, B) again at G. Let AD intersect CF at H. Let BG intersect DF at I. Let HI intersect circle(A, B) at J and K. Let BG intersect EJ at L. Let BJ ...


36

POV-Ray, 199 163 Old version camera{location -9*z}light_source{-9*z}#declare L=union{#for(X,-9,9,2)#for(Y,-9,9,2)cylinder{X*x+x+Y*y,<.001*pow(-1,(X+Y)/2),0,.1>+X*x+x+Y*y,1}#end#end}object{L pigment{color x}}object{L rotate z*90} Same output, but golfed down further by using default light/camera, so I dont even need to specify them #declare L=union{#...


35

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, only draw lines if needed, and draw it as long as possible. Thanks Arnauld, save 2 3 bytes


35

Wolfram Language (Mathematica), 20 bytes RandomPoint@Sphere[] Try it online! Does exactly what it says on the tin.


Only top voted, non community-wiki answers of a minimum length are eligible