# Print a smiley face

Requirements

For the sake of the challenge let's define a unit:

A unit is defined as any point that compose the grid in which the face is drawn (pixels for screen, characters for ASCII art, etc..).

The minimal requirements for the face are:

A smiley face is composed of a shape that resemble a circle (not necessarily perfect) of any radius. There must be at least 1 unit for each of the two eyes and at least 2 units for the mouth. Both eyes and mouth should be within the face shape. The mouth can be oriented however you want (happy, sad, indifferent, etc..).

Here's an example of the output:

 0 0 0    . . .
0 . . 0  . o o .
0 --- 0  . \_/ .
0 0 0    . . .


Goals

Of course the main goal is to come up with the shortest code possible, but art is also important.

Winner

The winner is chosen based on the amount of votes from the users, in, at least, the next 5 days.

• – DavidC Dec 29 '13 at 2:16
• Wow, 8 questions on the hot question list. Our site should be getting more traffic. – Justin Dec 29 '13 at 6:27
• Isn't indifferent face strictly easier than happy, and sad sometimes more difficult? – o0'. Dec 29 '13 at 13:50
• Not going to make this an answer since it doesn't fit the minimum requirements, but I wanted to chime in... alt + 1 and alt + 2 will produce ☺ and ☻ respectively. For the sake of argument I'll consider the alt key press a character and call that 2 characters. – Dryden Long Dec 30 '13 at 17:30
• Will this thread ever end? :) – avall Jan 13 '14 at 10:43

## Javascript, 340

var i=0,b=document.body,d=20,n=b.clientWidth,m=b.clientHeight,f="width=10,height=10,"
var o=new Function("f","i","t",'open("","",f+"left="+i+",top="+t)')
for(j=0;j<m/d;++j,i=j*d){
u=Math.sqrt(i*(m-i))
t=m/2+u*(j%2-0.5)*2
o(f,i,t)
i>m/5&&i<0.8*m&&j%2&&o(f,i,t-m/4);
((i<m/3&&i>m/4)||(i<3*m/4&&i>2*m/3))&&o(f,i,m/3)
}


## Javascript, 283

optimized version (with some improvements & without unnecessary white spaces)

var i=0,b=document.body,d=20,n=b.clientWidth,m=b.clientHeight,f="width=10,height=10,"
function o(i,t){open("","",f+"left="+i+",top="+t)}for(j=0;j<m/d;i=++j*d){u=Math.sqrt(i*(m-i));t=m/2+j%2*2*u-u;o(i,t);i>m/5&&i<0.8*m&&j%2&&o(i,t-m/4);((i<m/3&&i>m/4)||(i<3*m/4&&i>2*m/3))&&o(i,m/3)}


Well.. maybe it isn't as short as you would want to but it's unconventional for sure. It looks better when your browser is maximized. I really enjoyed your question! If you want to increase the details just reduce d variable slightly.

edit: Unfortunately I can't run it on jsfiddle but you can paste it to Javascript console in aby browser. Oh, and enable popups on the page :).

edit2: You can run it making a new html file and paste the code into it:

<body>
<script>
var i=0,b=document.body,d=20,n=b.clientWidth,m=b.clientHeight,f="width=10,height=10,"
var o=new Function("f","i","t",'open("","",f+"left="+i+",top="+t)')
for(j=0;j<m/d;++j,i=j*d){
u=Math.sqrt(i*(m-i))
t=m/2+u*(j%2-0.5)*2
o(f,i,t)
i>m/5&&i<0.8*m&&j%2&&o(f,i,t-m/4);
((i<m/3&&i>m/4)||(i<3*m/4&&i>2*m/3))&&o(f,i,m/3)
}
</script>
</body>


Then when you run it and nothing happens, just enable the popup windows and reload the page. In addition I paste

• In the name of Bwian of Judea, what is this... – nitro2k01 Dec 29 '13 at 12:08
• Now it's working. Took me about 2m to close all popups – s3lph Dec 29 '13 at 20:27
• After spending so much time trying to disable annoying popups, enabling them is hard. I disabled adBLock and allowed all popups in my browser...after half the face appears, it decides to turn the blocker back on! – Charity Leschinski Dec 30 '13 at 1:54
• Amazing out-of-the-box thought! I would never think to do something like this. – Gari BN Jan 16 '14 at 10:01
• That's outstandingly original! – Oberon Jan 16 '14 at 14:16

# HTML, 200 141 characters

Thanks to avail, I've cut this down to 141 characters:

<fieldset><legend>\\\\\\\\\\\\ ////</legend><center><input size=1 value=o> <input size=1 value=o /><br><input type=radio><br><button>........


Here's the original HTML:

<fieldset>
<legend>\\\\\\\\\\\\ ////</legend>
<center><input type=text size=1 value=o />
<input type=text size=1 value=o /><br/>
<button>........</button></center></fieldset>


Works best on small screens:

• This is art :P – Shoe Dec 29 '13 at 22:53
• You don't have to close most of your tags (most browsers will handle it), you don't need to define the type of input (text is default) and don't close <br> (html5). Here's the optimised code with only 150 chars :): jsfiddle.net/avall/TdPkF – avall Dec 30 '13 at 0:38
• @avall Excellent, thanks :-) – r3mainer Dec 30 '13 at 0:55
• 158 chars and now centers the hair so it looks good on any size screen. jsfiddle.net/TdPkF/5 – AverageMarcus Dec 30 '13 at 8:27
• @squeamishossifrage You should remove all but 3 of the hairs, and then it would be Homer Simpson! – mbomb007 Jan 16 '15 at 17:48

# Brainfuck: 583 characters (without counting whitespace)

 >>------>->->+++++>->->---->>>>------>>>>
>>>>---->->------->>->->->---->>-------->
->->------>>>>>>>>>>-->---->>-->---->>->
-->>>------>>>>>>>>->---->---->>->->->-
>>->---->---->>++++[-<++++>]<[-<++++
++<++++++++<+++<++<++++++<++++++<++++++
<++++++<++<++++++<++++++++<+++<++<++<++<++
<++<++<++<+<++<++++<++++++++<+++<++<+++<+++
<++<++++++   <++++++++<++++<    ++<++<++<++
<++<++<++<++<+<+++<++++++<+++<++<++++++<+++
+++<++++++<+++<++<++  +<++++++<++++++<++<++
<++<++<++<++<++<+<++<++<++<++++++<++++++
<++++++<+++++<++++++<+++<+>>>>>>>>>>>>
>>>>>>                       >>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>]<[.<]


Output:

\|/ ____ \|/
@~/ ,. \~@
/_( \__/ )_\
\__U_/

• The original code looks a bit like a face (if you try really hard...), I wonder how hard it would be to make the code and output both be faces... – w4etwetewtwet Dec 29 '13 at 18:25
• @handuel Both are faces, but different. Did you mean the code and the output to be the same like a quine? I'm sure it can be done. – Sylwester Dec 29 '13 at 18:30
• I just meant for the code to look more like a face, I didn't realize it was intentional. – w4etwetewtwet Dec 29 '13 at 18:31
• In Brainfuck, everything that is not a control character is a comment. That is why the source code can be made to look like a smiley. – Emil Vikström Jan 1 '14 at 22:35

# SVG

<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<stop offset="0" stop-color="#fff"/>
<stop offset="0.6" stop-color="#ff0"/>
<stop offset="1" stop-color="#f80"/>
</defs>
<circle fill="url(#f)" stroke="#000" stroke-width="2" cx="100" cy="100" r="90"/>
<ellipse cx="70" cy="70" rx="10" ry="20"/>
<ellipse cx="130" cy="70" rx="10" ry="20"/>
<path fill="none" stroke="#000" stroke-width="5" d="M 40 120 S 100 200 160 120"/>
</svg>


Renders like this:

• Infinite units? – user80551 Dec 31 '13 at 15:02
• The right tool for the right job. – Alpha Jan 3 '14 at 2:02
• I wouldn't say SVG is really a programming language – Oliver Ni Jan 2 '15 at 4:43
• @Oliver It's as much a programming language as HTML is... (which it isn't). – mbomb007 Jan 16 '15 at 17:49

## Ruby, 224

Douglas Adams would be horrified. :-P

w=?$;"^XA[_AXeMFGIAHJLjKNAEFEJJNHQHNKLAEMINJOJOHLAGKHOJOJ[AG[HQHRFJAH}IH IGGwIIAHHGwKHAHGHrEUAGQFiGVAGQGfIPAFHKHHbJHAQII]MGASHNSOHATIdIAUJJRLIAWLIQGK ZOFUA]ZAeSAiPAjOAkL".codepoints{|r|r-=68;$><<(r<0??\n:(w=w==?$?' ':?$)*r)}


Output:

                          
   $   $          $ $      $ $   $  $
$$        
           $  $

$  ## Ruby, 110 Same technique. Less code. Less artful. Looks like someone melted a plastic smiley. :-} w=?$;"TXANdAKQGZAHSI[AGaGRAFaIRAFPGeAGQJ_AHURQAJkANc
TX".codepoints{|r|r-=68;$><<(r<0??\n:(w=w==?$?' ':?$)*r)}  Output:    $   $ $     $$              $$


• Does the second example count? There's no circle around the face. – Kevin Dec 29 '13 at 19:01
• @Kevin, good point. Amended. – Darren Stone Dec 29 '13 at 19:42

# QBasic ASCII, 134 (unoptimized)

SCREEN 1
PRINT CHR$(1) FOR i = 0 TO 64 x = i \ 8 y = i MOD 8 LOCATE y + 2, x + 1 IF POINT(x, y) THEN PRINT "X" NEXT  This answer totally cheats by using ASCII character 1 for its smiley. However, unlike the BF and "plain text" answers, it actually obeys the rules by making ASCII art based on the pixels of the smiley character, rather than just plainly printing the character as its full solution. The unoptimized version represents how QBasic's IDE saves the files. The IDE is "helpfully" fixing up the syntax for us and adding a lot of whitespace where "needed". Output: # QBasic ASCII, 80 (optimized) SCREEN 1 ?"☺" FOR i=0TO 64 x=i\8 y=i MOD 8 LOCATE y+2,x+1 ?CHR$(POINT(x,y))
NEXT


This is an optimized version of the first code sample, which still loads in QBasic. Things that were done:

• Removed all unnecessary whitespace. (D'uh!)
• Changed the CRLF line breaks to LF only.
• Replaced CHR$(1) with a string containing the actual character. (Here illustrated with a matching Unicode character. If you actually want to try the code, please replace it with a real ASCII character 1 using a hex editor.) • Replaced PRINT with ?, as the BASIC tradition allows for. • Replaced the IF line with a line that prints characters based on the source pixel value. This will be be either 0 or 3. 0 is the color black. Character 0 prints a null character which is treated like a space. 3 is the color white in CGA's 4-color palette. ASCII character 3 is a heart. Output: # QBasic graphical, 83 (whitespace optimized) SCREEN 1 CIRCLE(50,50),50 CIRCLE(50,50),30,,4,5.4 CIRCLE(30,40),10 CIRCLE(70,40),10  But wait, I here you ask, can't you just use QBasic's built-in graphics commands? Sure, but that won't actually save you any bytes, because of the verbosity of the language. But it does have a built-in function to only draw a circle arc between two given angles, which is nice. The angles are given in radians, and 4 and 5.4 approximate a circle arc symmetrically centered around π*3/2, or if you've joined the good side, τ*3/4. Output: Note: The sizes in this answer denote how big the file is in, in bytes. • I feel that I may be the youngest person here who can still read QBASIC... :) Nice one – apnorton Dec 30 '13 at 16:45 # APL, 97 chars/bytes* (63⍴1 0)\' /%'[1+(12≥⊃+/¨2*⍨m+¨⊂6 ¯6)+((⍉18<(⍴n)⍴⍳32)∧28≥|100-n)+256≥n←⊃+/¨2*⍨m←x∘.,|x←¯16.5+⍳32]  It works by computing a few circle equations. Tested on GNU APL. Output ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ *: APL can be written in its own (legacy) single-byte charset that maps APL symbols to the upper 128 byte values. Therefore, for the purpose of scoring, a program of N chars that only uses ASCII characters and APL symbols can be considered to be N bytes long. # Bash, 63 chars echo$'$the_cow=""'>.cow;cowsay -f ./.cow$'O O\n\n\_/';rm .cow


Output:

 _____
/ O O \
|     |
\ \_/ /
-----


Artistry:

Cows.

# Bash, 22 chars

wget x.co/3WG0m -q -O-


Sample output:

Edit: this could be golfed further as suggested by several people. The shortest self-contained version found so far is:

curl -L x.co/3WG0m


(thanks nitro2k01)

• Could be optimized to curl -L x.co/3WG0m. Could be further optimized if we have a local, one-character hostname which also return the data directly (eliminating the -L switch needed to follow redirects.) – nitro2k01 Dec 29 '13 at 22:10
• Where's the challange in posting a smiley in pastebin and downloading it using wget? – s3lph Dec 30 '13 at 11:34
• @the_Seppi: that's exactly the joke. It's intended as a thinking-outside-the-box solution. – Riot Dec 30 '13 at 15:29
• We need to find someone with access to the root nameservers and convince him to add a domain called Z that points to a server hosting the file. – marinus Dec 31 '13 at 5:46
• beautiful, this is my favorite :) – jcora Dec 31 '13 at 15:45

Python 247 230 227 Characters - and a cuter version

from matplotlib.pyplot import*
from numpy import*
y=x=arange(-8,11,.1)
x,y=meshgrid(x,y)
contour(x,y,(x*x*(x**2+2*y*y-y-40)+y*y*(y*y-y-40)+25*y+393)*((x+3)**2+(y-5)**2-2)*((x-3)**2+(y-5)**2-2)*(x*x+(y-2)**2-64),[0])
show()


Python 243 Characters - Using colors

from pylab import*
from numpy import*
y=x=arange(-9,11,.1)
x,y=meshgrid(x,y)
contourf(x,y,(x*x*(x**2+2*y*y-y-40)+y*y*(y*y-y-40)+25*y+393)*((x+3)**2+(y-5)**2-2)*((x-3)**2+(y-5)**2-2)*(x*x+(y-2)**2-64),1,colors=("#F0E68C",'#20B2AA'))
show()


# C++ - 122 characters without unnecessary spaces

This is the most realistic I could come up with:

#include <iostream>

int main() {
std::cout << "  |||||\n 0 . . 0\n0   ^   0\n0  \\_/  0\n 0     0\n  00000\n   888\n    8\n\n";
}


For those of you who are missing out, it creates this:

• return 0; is not required in ISO C++ :) – Shoe Dec 29 '13 at 12:03
• Thanks. That will help cut characters in future puzzles. – user10766 Dec 29 '13 at 14:52
cowsay -f calvin Hey, What´s up?
_________________
< Hey, What´s up? >
-----------------
\                   .,
\         .      .TR   d'
\      k,l    .R.b  .t .Je
\   .P q.   a|.b .f .Z%
.b .h  .E # J: 2     .
.,.a .E  ,L.M'  ?:b | ..J9!.,
q,.h.M   ..,   ..,"" ..2"
.M, J8   :          3;
.    Jk              ...,   ^7"90c.
j,  ,!     .7"'j,.|   .n.   ...
j, 7'     .r     4:      L   ...
..,m.      J    ..,|..    J  7TWi
..JJ,.:    %    oo      ,. ....,
.,E      3     7g.M:    P  41
JT7"'      O.   .J,;       V"7N.
G.           ""Q+  .Zu.,!      Z
.9.. .         J&..J!       .  ,:
7"9a                    JM"!
.5J.     ..        ..F
78a..       ..2'
J9Ksaw0"'
.EJ?A...a.
q...g...gi
.m...qa..,y:
.HQFNB&...mm
,Z|,m.a.,dp
.,?f ,E?:"^7b
A| . .F^^7'^4,
.MMMMMMMMMMMQzna,
...f"A.JdT     J:    Jp,
JNa..........A....af
^^^^^'


# PHP, many other languages... - 1601 characters

                          oooooooo
ooo
oo$$o o$$ o$o$ oo        oo        $$o oo   " o$$$$o$$$o$$o "$$o$     o$o  $      $ """$$"$$$""""$"$   o$$"$$$o o$$"$$$       $$o$$$$" "$$ooooo$$$$o o$$$oooo$  $o$
"   $$"""""""" """"$$$$"$$$$" o$$$"$$o """$$"$$"$$$
$$o "$$""$$"""" o$$$o o$$" "$$$$o o$$o"o o "$oo     ""o$o o"" ""$oooo  "$$o$$$$""" ""$$$oo $$""""$$$

$$" "$$$""  Smiley source: Asciiworld.com : Smiley ## html, css I know it's neither short nor real coding, but I still wanted to post this <head> <style> #a{ width:100px; height:100px; border-radius:50px; border: 1px solid black; } #b{ position: absolute; top:30px; left:30px; width:20px; height:20px; border-radius:10px; border: 1px solid black; } #c{ position: absolute; top:0px; left:40px; width:20px; height:20px; border-radius:10px; border: 1px solid black; }#d{ position: absolute; top:30px; left:-30px; width:40px; height:20px; border-radius:10px; border: 1px solid black; } </style> </head> <body> <div id="a"> <div id="b"/> <div id="c"/> <div id="d"/> </div> </body>  jsFiddle • Maybe would look better with #d{border-radius:20px/10px;}. Or with #d{border-radius:0 0 20px 20px/0 0 10px 10px;}. Or with #d{height:10px;border-radius:0 0 20px 20px/0 0 10px 10px;margin-top:10px;}. – manatwork Dec 30 '13 at 12:40 ## Rebmu, 24 chars Oh, the m-i-n-i-m-a-l humanity. :-) Least impressive Rebmu program yet, so purposefully embedding pHp as a tribute to the blue pill in the programming world: H{ -- }pHp{|..|^/|\/|}pH Execution: >> rebmu [H{ -- }pHp{|..|^/|\/|}pH] -- |..| |\/| --  Explanation Rebmu is just a dialect of Rebol. It inherits the parse constraints, uses abbreviated terms without spaces separated by runs of capitalization. It has a special treatment when the first run is capitalized vs uncapitalized. (So rather than separating terms like AbcDefGhi it can use the difference between ABCdefGHI and abcDEFghi to squeeze out a bit of information. Sequences whose runs start in all capitalized are separated so the first term represents a "set-word!", often contextually interpreted as a desire for an assignment. see video) If you want to translate this to native Rebol, you have to accept things like that it starts with a capital H to mean that's actually an h: and not an h. The source is thus analogous to: h: { -- } print h print {|..|^/|\/|} print h  Assigns the string -- to h (using asymmetric string delimiters because print {"Isn't it nice," said {Dr. Rebmu}, "when you have asymmetric multi-line string delimiters with no need for escaping matched nested pairs, and that accept apostrophes and quotes too?"} Prints h once, prints another string where ^/ is the escape sequence for newline (carets being less used in software than backslashes which appear often in paths), prints h again. # JavaScript 262 251 Edit: added better eyes. Prints a smiley face into the console. Could lose quite a few characters to make my bitmask simpler and print a less pretty face, or use a circle equation instead of an ellipse to account for character spacing - but that's not the spirit. You can change the r variable to change the size and get a more or less detailed face; any number >=7 && <=99 will give a good result and stay within the character limit. function c(e,t,n){return t/2*Math.sqrt(1-e*e/(n*n))+.5|0}r=42;p=r/2;q=p/5;s="";for(y=-p;++y<p;){for(x=-r;++x<r;){d=c(y,r*2,p);e=c(y+q,r/5,q);f=e-p;g=e+p;h=c(y,r*1.3,r/3);s+=x>=d||x<=-d||x>=-g&&x<f||x<=g&&x>-f||y>q&&x>-h&&x<h?" ":0}s+="\n"}console.log(s)  Human readable: function c(y,w,h){return w/2*Math.sqrt(1-y*y/(h*h))+0.5|0} r = 42 p = r/2 q = p/5 s = '' for (y = -p; ++y < p;) { for (x = -r; ++x < r;) { d = c(y,r*2,p) e = c(y+q,r/5,q) f = e - p g = e + p h = c(y,r*1.3,r/3) s+=(x>=d||x<=-d||(x>-g&&x<f)||(x<g&&x>-f)||(y>q&&(x>-h&&x<h)))?' ':0 } s += '\n' } console.log(s)  Output: My first game of golf so likely to be some improvements. Perl, 106 chars It is a Perl oneliner, just have to C&P it on command prompt, provided the Perl Acme::EyeDrops module is already installed on the machine. touch temp && perl -MAcme::EyeDrops='sightly' -e 'print sightly({Shape=>"smiley", SourceFile => "temp" } );'  Another way , a smiley with Pulling a face  touch temp && perl -MAcme::EyeDrops='sightly' -e 'print sightly({Shape=>"smiley2",SourceFile=>"temp"});'  Yet another way,a smiley with Pulling a face upside down,  touch temp && perl -MAcme::EyeDrops='sightly' -e 'print sightly({Shape=>"smiley2",SourceFile=>"temp",RotateFlip=>'true',Rotate=>'180'});'  # Bash + ImageMagick: 137 characters c=circle convert -size 99x99 xc: -draw "fill #ff0$c 49,49,49" -fill 0 -draw "$c 30,35,30,30$c 70,35,70,30 ellipse 50,60,25,20,0,180" x:


Sample output:

But as this is an challenge…

# Bash + ImageMagick: 172 characters

d=-draw
p=-pointsize
convert -size 99x99 xc: -font times.ttf $p 140 -stroke 0 -fill \#ff0$d 'text 0,96 O' $p 40$d 'text 25,50 "o 0"' $p 50$d 'rotate 95 text 50,-40 D' x:


Sample output:

# GolfScript, 27

This outputs the 2nd example exactly as given.

' .'3*.'
. o o .
. \_/ .
'\


First one can be done the same way, but I think the 2nd one looks nicer :)

# Brainf*** - 2

+.


Prints ☺ or ascii value 1. (might not work with some platforms)

• Nitpick: ASCII 1 is SOH, a non-printable character. That smiley is U+263A, or 1 in CP437, what you are probably using. Unfortunately, your output fails the condition of using enough “units” for the eyes and mouth. – Christopher Creutzig Dec 29 '13 at 9:42
• @ChristopherCreutzig It does not fail that condition. Each eye is 1 or so pixels, the mouth is more than twice as large. – Justin Dec 29 '13 at 15:57
• The exp. "ASCII ART" consists of two parts. I see neither of them here – s3lph Dec 30 '13 at 11:37

c(){ e "define a(i){scale=scale(i);return(sqrt(i*i));};""$@"|bc -l;};e(){ echo "$@";};s(){ h=$1;c=$2;if [ -z $c ];then c=" ";fi;while (($((h=h-1))>0));do e -n "$c"; done; };m(){ t=c 2*$1;while (($((t=t-1))));do l=c a$$1-t$$+1;s$l;q=c 2*$$1-l$$;w=s $q;if (($l>$t&&$l<($t+3)&&$q>2)); then w=" "s $((q-2)) 0" ";elif (($t>($1+1)&&$q>3));then g=s $(((q-1)/2)) 0;w="$g $g ";fi;e -n +;if [ ! -z "$w" ];then e -n "$w+";fi;e;done;};  Example output: (called by m 8)  + + + + + + 0 0 + + 00 00 + + 000 000 + + + + + + + + + + + + 000 + + + + + +  Kind of crazy, but I chose to use a diamond instead of a circle. The eyes are covered by safety goggles. # BASH - 252 characters (thanks @manatwork) s(){ (($1>1))&&echo -n "${2:- }"&&s$[$1-1]$2;};m(){ ((t=2*$1));while ((t=t-1));do v=$[$1-t];l=$[${v#-}+1];s$l;q=$[2*($1-l)];w=s $q;((l>t&&l<t+3&&q>2))&&w=" s$[q-2] 0 ";((t>$1+1&&q>3))&&{ g=s$[(q-1)/2] 0;w=" $g$g ";};echo "+${w:+$w+}";done;}

• Cool. With that shape it could replace my gravatar image. :) It can be reduced to 252 characters: s(){ (($1>1))&&echo -n "${2:- }"&&s $[$1-1] $2;};m(){ ((t=2*$1));while ((t=t-1));do v=$[$1-t];l=$[${v#-}+1];s $l;q=$[2*($1-l)];w=s$q;((l>t&&l<t+3&&q>2))&&w=" s $[q-2] 0 ";((t>$1+1&&q>3))&&{ g=s $[(q-1)/2] 0;w="$g $g ";};echo "+${w:+$w+}";done;}. Or 245 if you give up the function m and put the code in a script file. Probably can be reduced even more by tweaking the calculations, but I have no time for that now. – manatwork Dec 30 '13 at 11:53 HTML + CSS, 83 <div><a>o<a>o</a><hr><hr><style>a,div{width:2em;border:2px solid;border-radius:8px  screenshot(using firefox): too bad that I'm too late with my answer (got +10 rep also quite late ...) • I like it more with border-radius:50% and a single <hr>: dabblet.com/gist/8472397 – manatwork Jan 17 '14 at 12:08 • @manatwork or like this: jsfiddle.net/T9BdL/1 – Tim Seguine Jan 17 '14 at 12:11 • @TimSeguine, using a literal non-breaking space character is shorter than &nbsp;: jsfiddle.net/T9BdL/2 – manatwork Jan 17 '14 at 12:23 • Eyes overlapping the face is against the rules, I think. That's why I did it like it is currently. Also it kinda reminds me of the canadians face in south park. – Leo Pflug Jan 17 '14 at 12:39 • Not really golfed, but as requested, a css only version: jsfiddle.net/T9BdL/9 – Tim Seguine Jan 17 '14 at 13:54 # GolfScript, 18 This program uses some binary-encoded values which appear as weird/invalid characters in a text editor. Here's the hex dump: 00000000 27 c1 94 80 a2 9c c1 27 7b 32 62 61 73 65 20 70 |'......'{2base p| 00000010 7d 25 |}%|  Note: it doesn't work in a UTF-8 locale, but works fine with ISO-8859-1 for example. The expanded version with escaped characters: "\xc1\x94\x80\xa2\x9c\xc1"{2base p}%  Output: [1 1 0 0 0 0 0 1] [1 0 0 1 0 1 0 0] [1 0 0 0 0 0 0 0] [1 0 1 0 0 0 1 0] [1 0 0 1 1 1 0 0] [1 1 0 0 0 0 0 1]  For nicer output, you can replace the block with {2base{38+}%n} which brings the binary version to 23 bytes. Expanded version: "\xc1\x94\x80\xa2\x9c\xc1"{2base{38+}%n}%  Output: ''&&&&&' '&&'&'&& '&&&&&&& '&'&&&'& '&&'''&& ''&&&&&'  # JavaScript This code must be run in f12 on this page: console.log(document.getElementsByTagName("code")[0].innerHTML)  Output:  0 0 0 . . . 0 . . 0 . o o . 0 --- 0 . \_/ . 0 0 0 . . .  # CJam, 18 I decided to go for short code... Try it here. " ##O#- #"2/{_(N}%  ## Explanation " ##O#- #" "Push a string onto the stack"; 2/ "Split it into an array of two-character groups"; {_(N}% "For each item in the array, execute _(N : duplicate the element, remove the first character and place it onto the stack after what's left, and push a new line.";  This exploits the symmetry of the smiley face I designed. ## Output  ## #OO# #--# ##  • This face it not smiling ;). – Optimizer Dec 26 '14 at 21:49 • @Optimizer It's closer to a smile than this... Because of how I've used symmetry, you can't have a smile here. – user16402 Dec 26 '14 at 21:53 • Using uu for the smile is an option, if you're going for that "cat" kind of smile... – mbomb007 Jan 16 '15 at 17:42 # Python smileyFace = ''' 000000000000000 00000000000000000 000000 00 00000 0000000 . 00 . 000000 00000000 00 0000000 0000000000000000000000000 000000 . 00000000 . 0000000 000000 . 000000 . 0000000 0000000 ....... 0000000 000000000000000000000 0000000000000000000 00000000000000000''' print(smileyFace)  print(' _________\n / \\\n | /\\ /\\ |\n | - |\n | \\___/ |\n \\_________/');  Output:  _________ / \ | /\ /\ | | - | | \___/ | \_________/  • second example is missing the circle – Jasen Dec 26 '14 at 22:50 • @Jasen I fixed it. – Oliver Ni Dec 27 '14 at 2:10 ## Javascript console a frog: prompt("◉◉ ", ' '.repeat(25)+"⊂(‿)つ")  table flip prompt("┻━┻", ' '.repeat(24)+"ʕノ•ᴥ•ʔノ")  and i am not sure what this one is prompt('◕ '.repeat(24),prompt("◕ ◕", ' ▇ '.repeat(24)))  ## Python, 42 print ' 0 0 0 \n0 . . 0\n0 --- 0\n 0 0 0 '  HTML 5 : 321 Characters <canvas id=a><script>_=document.getElementById("a"),c=_.getContext("2d"),p=Math.PI,P=2*p;C();c.arc(95,85,40,0,P);B();c.lineWidth=2;c.stroke();c.fillStyle="red";C();c.arc(75,75,5,0,P);B();C();c.arc(114,75,5,0,P);B();C();c.arc(95,90,26,p,P,true);B();function C(){c.beginPath()};function B(){c.closePath();c.fill()}</script>  Fiddle : http://jsfiddle.net/wfNGx/ # Shell command or builtin $ echo -e ' ,---.\n/ o o \\\n\ \\_/ /\n ---´'
,---.
/ o o \
\ \_/ /
---´
\$ printf ' ,---.\n/ o o \\\n\ \\_/ /\n ---´\n'
,---.
/ o o \
\ \_/ /
---´


Depending on the flavour of your shell or command set, echo may or may not interprete control characters with or witout -e... (...and I demand that I may or may not be Vroomfondel!) just try... and if all else fails, using printf should be a safe bet...