# 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

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

document.write("&#9786;")

You should get the Unicode smiley face! Granted, it's a little cheaty, but it satisfies all the requirements:

A smiley face is composed of a shape that resemble a circle (not necessarily perfect) of any radius. (Check! The shape resembles a circle)

There must be at least 1 unit for each of the two eyes and at least 2 units for the mouth. (Check! Given the rule for a unit also allowing for pixels, this rule is also satisfied!)

Both eyes and mouth should be within the face shape. (Check, eyes and mouth are wholly within the face shape!)

The mouth can be oriented however you want (happy, sad, indifferent, etc..). (Check! Already smiling!)

• other fonts have that glyph too, here's a variation on yours:alert("\u263a"); – Jasen Dec 27 '14 at 2:35
• also: document.write("\u263a") – Jasen Dec 27 '14 at 2:36
• Your image isn't drawn with pixels, it's drawn with characters. I'm pretty sure this doesn't meet the requirements. – mbomb007 Jan 16 '15 at 17:45

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


## Plain text, 1​​​​​

☺

It looks good and is scalable, too.

• Looks like the squared face guy sitting in front of me (a.k.a a box). – Frenzy Li Dec 29 '13 at 4:25
• Doesn’t seem to me to use enough “units.” – Christopher Creutzig Dec 29 '13 at 9:44
• The whole idea in defining a "unit" was to prevent this kind of answers, that have, already, been posted here. – Shoe Dec 29 '13 at 12:05
• @Jefffrey: I wasn’t going to add this one, but then I read that in your definition of “units” you also said “pixels”. I’ll delete it if you’d like to clarify that, though. – Ry- Dec 29 '13 at 19:16
• I just see a box (Google Chrome Version 31.0.1650.63 m). Where are the eyes and mouth? – user13267 Dec 31 '13 at 8:40

VB.net (52c)

Module P
Sub Main()
Console.Write("☺")
End Sub
End Module