# minigolf - display anything 3d [closed]

The goal is to write the smallest program in any language which displays any three dimensional output. It might be graphics, it might be ASCII art, but any reasonable person should immediately and unambiguously recognize it as "something 3d".

Opening external files or other resources is not allowed. All output has to be generated by your program.

The shortest code with a score higher than 1 wins.

## closed as not constructive by Peter Taylor, Toto, manatwork, cardboard_box, zzzzBovApr 25 '13 at 18:06

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

• Where are you going to find a reasonable person? This isn't objective enough to be called a spec. – Peter Taylor Apr 25 '13 at 8:39
• @vsz, there are so many trivial answers to this question that you are probably better off making it a pure popularity contest. – user7486 Apr 25 '13 at 10:03
• @dan1111, or closing it as "not a constructive question". – Peter Taylor Apr 25 '13 at 10:18
• FWIW, there was an attempt in the sandbox (which might still be ongoing) to define a good 3D drawing question – Peter Taylor Apr 25 '13 at 10:20
• from the CowSay question: codegolf.stackexchange.com/a/11252/5011 (not mine, so not taking credit) – SeanC Apr 25 '13 at 15:05

## HTML, 1 character

❒


This will appear as:

There are several other characters that look three dimensional (at least to me) if you don't like that one:

# ❒ ❍ ✰ ✞ ➫ ➮ ➪ ♨ ✐ ✏

## QBASIC 211 bytes

SCREEN 13
WINDOW(-160,-100)-(159,99)
FOR x=0TO 63
PALETTE x,x*65793
NEXT
FOR i=16TO-16STEP-.1
FOR j=16TO-16STEP-.05
s=SQR(i*i/2+j*j/2)
PSET(i*10,j*5+17.32*COS(s)),18.2*(COS(s)-SIN(s)*j/s)+31+RND
NEXT
NEXT


The color for each pixel is chosen by adding the z value on the curve with the partial derivative with respect to y, generating a 'fake' lighting effect. The added random value helps to smooth the borders between regions. Produces something similar to the following:

## PHP, 23 characters

<?=" __\n/_/|\n|_|/\n";


Outputs:

 __
/_/|
|_|/

• Why not do it in GolfScript? You can use newline for one char rather than two inside ' – Peter Taylor Apr 25 '13 at 8:25

## Lua, 12 characters

print'(.Y.)'


## Logo, 31 characters

My Logo is a bit rusty, but this should draw a torus:

repeat 180[rt 2 circle 45 fw 3]


Run it online: http://logo.twentygototen.org/9NxYy2Pw.

# Mathematica 19

Graphics3D@Cuboid[]


## Python, 11 characters

print'()))'


Prints:

()))


It's a tube an overturned barrel.

• +1 for linking to the Wikipedia page for cylinders, because the concept of tube definitely needed more explanation :D – user7486 Apr 25 '13 at 10:23
• Overturned barrel? – Egor Skriptunoff Apr 25 '13 at 13:05

# Perl, 7 characters

print A


Prints a road (which has a line painted across it) receding into the distance.

• ...looks more like the letter A to me :P – Volatility Apr 25 '13 at 9:34
• @Volatility, then according to my working definition of reasonable, you aren't reasonable :) – user7486 Apr 25 '13 at 9:38

## Python 337 bytes

from pygame import*
from math import*
init();d=display;s=d.set_mode((640,480));a=0
def R(x,y,z,a):c,s=cos(a),sin(a);y,z=y*c-z*s,y*s+z*c;z,x=x*s-z*c-8,z*s+x*c;f=1e3/z;return-f*x+320,f*y+240
while s.fill(time.wait(5)):event.get();t=[R(x,y,z,a)for x in-1,1for y in-1,1for z in-1,1];[draw.line(s,-1,i,j)for i in t for j in t];a+=.01;d.flip()


A basic cube spinner.

• Put R on one line, replace the nested for loop with [draw.line(s,-1,i,j)for i in t for j in t] and then put the whole while loop on a single line. That'll save you quite a few bytes. – Volatility Apr 25 '13 at 10:18

## R - 73 characters

Way longer than the previous answer but i like it:

t=seq(0,2*pi,.01);r=1e3:1;plot(r%o%cos(t),r%o%sin(t),col=grey(1:1e3/1e3))


Basically draw a thousand circles of decreasing radius and shade of grey. Because of the default aspect ratio the result is more an ellipsoid than a sphere however.

# Python, 0 characters

Output:

>>>


Which can only reasonably be interpreted as some sort of angled surface :). I prefer to think of it as a jagged, concave cliff face.

• To me seems like the first step of a paper folding diagram… – manatwork Apr 25 '13 at 10:11
• LOL !!! 0 Charachters solution !! :D – tusharmakkar08 May 2 '13 at 11:03