# 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.

• Dec 29 '13 at 2:16
• Wow, 8 questions on the hot question list. Our site should be getting more traffic. 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. Dec 30 '13 at 17:30
• Will this thread ever end? :) Jan 13 '14 at 10:43

## C 178 characters:

source (whitespace added - all can be removed except at int x

int x,y;
c(a,b,r)
{
return  (x-a)*(x-a) + (y-b)*(y-b) < r*r;
}

main()
{
for(x=9;x>=-9;--x)
{
for(y=-9;y<=9;++y)
putchar(32<<(
c(0,0,10)&&!(c(4,4,2)|c(4,-4,2)|c(3,0,8)&!c(7,0,10))
));
putchar(10);}
}


output:

     @@@@@@@@@
@@@@@@@@@@@
@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@
@@@   @@@@@   @@@
@@@@   @@@@@   @@@@
@@@@   @@@@@   @@@@
@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@
@@@ @@@@@@@@@@@ @@@
@@@  @@@@@@@@@  @@@
@@@@           @@@@
@@@@@@       @@@@@@
@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@
@@@@@@@@@@@
@@@@@@@@@


## T-SQL, 628

For SQL Server 2012+

This is a query I did some time ago as a bit of fun and to show my kids.
It uses the string in @ to determine a few parameters B = base, O = offset, M = multiplier, D = divisor. These are then used to create a SQL Server Geometry (2012+).

It's not particularly golfed.

DECLARE @ varchar(30)='Don''t Worry, Be Happy';
WITH P AS(
SELECT LEN(PARSENAME(F,1))D,
LEN(PARSENAME(F,2))M,
LEN(PARSENAME(F,3))B,
LEN(PARSENAME(F,4))O
FROM (VALUES(REPLACE(@,' ','.')))S(F)
)
SELECT @, Geometry::Point(B*M,B*M,0).STBuffer(B*M).STDifference((
SELECT Geometry::UnionAggregate(g)
FROM (
SELECT Geometry::Point(B*M-O,B*M+O,0).STBuffer(B/D*M)FROM P
UNION ALL
SELECT Geometry::Point(B*M+O,B*M+O,0).STBuffer(B/D*M)FROM P
UNION ALL
SELECT Geometry::STGeomFromText(
CONCAT('CIRCULARSTRING(',
B*M-O,' ',B*M-O,',',
B*M,' ',(B*M-O)-((B*M)/(B*M-O)),',',
B*M+O,' ',B*M-O,')'),0).STBuffer(B/D)FROM P
)A(G)
))
FROM P


When run in SSMS it shows the following in the spatial results tab

# Javascript, 857 bytes

Just some idle obfuscation.

un="̤̤Ո͈̤ՇՇ̤͆F͆Ë̠̠́̈́ ՃC̠B̠͂ՁՁ̠Հ@ ̿̿Ԡ̾͜ծ̽̽>̼͂̾̾Ի̽;͂Ժͅ$Թ̹͈8՜̢77Շ̶Է̷̵554̓ͯ3oͯԲHͯ18̤̰0̰/ͣoͮͳol̮ͥլ̨ͯͧՠ̻Ծ̈́22̰ԲԲԺD2/ͯԽ̻̲̓/F1@̳̤C͈̠o̤̽Գ$̠2́3̯0ͯ?HԠ͈̠1̤̽2 ̤ ̤̠7̤̳̓9̰̤͂BFG̱?Ԥ1̱̤̽6$Ա̤̈́3Թ̸̱̀̀͂ͅՅ=DF͇B̸Հ̸@̰Ը≠̰̈́B0$Ղ0Ḧ̵̶́̽̓64/̯̤A̶=Ղ͇3/̯͈A̷̤1Խ̳͈7Ճ/ԯ͇̤̿Ա=C͇B/̰̹Է ̶$̱2̲H1Խ̈́o$1̲̤ͯ͆Dԯ̰$̳̰Ն̤̽Dͅ6$Cԯ9$A̴̴̴̠͆̽Կ͆͂7̯F7̓3G̼7̤̱́57԰ՆՈ̷H̷> ͇<D̤1̾̈́7H5FH4Ծ̳͇<̓H̱̻̠2̳͇̾̈́7̻̽7H̱C3͆17͈1̳̻́͆̽̈́Զ1ͯ́5HԱG̱3̵̺͆̈́ 5G̱̲oD7̤1̹57̺͂5͆$1oԠ̹̤?:>B4̸̾Ժ̻̰̿Ժ̻̠9̷̤̺̀ԻD̶4=͠ԩ",ㅤㅤㅤ=window;for(ㅤ in {escape:ㅤㅤ="un"})for(_=ㅤㅤㅤ[${ㅤㅤ}${ㅤ}](ㅤㅤㅤ[ㅤ](un).replace(/u../g,[]));__=/[/-H]/.exec(_);)with(_.split(__ ))_=join(shift());setTimeout(_,0)


# ConTeXt/MetaPost (104 89 bytes)

This is a rather minimalistic smiley and you need at least 1000% zoom to see that poker face:

\startMPpage
let D=draw;D fullcircle scaled 5;D left;D right;D(-1,-1)--(1,-1)
\stopMPpage


You can compile the document here as a PDF