# Smile! Just smile

It's well known that Brainf*ck is very bad at Kolmogorov-complexity problems, for example, it requires around 100 characters just to print "Hello world".

However, there might be texts where Brainf*ck is just very good at.

Your task is now to write a program that takes no input, and it displays the following:

☺


That is, a smiley face (ASCII 1, if you browser does not render it).

Brainf*ck can do it in 2 characters.

+.


Try to find a language that beats it!

We assume your console can actually display that character (or your font has it, etc.).

Shortest code wins. If there are more of the same length, the first wins, but I'll upvote the others as well.

EDIT: I'm very sorry, I did not think the first post arrives this soon. A quick edit: the language has to be Turing-complete!

• I must dispute your description of the output: While your code really outputs a character with the binary code 1, it is not ASCII-encoded, but belongs to some DOS codepage encoding like CP850 or CP437. In any modern console the smiley will not appear, because modern == UTF-8. ☺ – Sven Nov 9 '12 at 16:06

## FALSE (2)

1,


All that reading about BF paid off! False is an ancestor of Brainfuck.

• Ouch! Strange that no one thought of this until now. :) – vsz Nov 9 '12 at 7:20
• I had to accept this one, as the versions with plain-text and html were not actually done with programming languages. – vsz Nov 17 '12 at 18:12
• I tried to do it with BLC, but I can't make any sense out of BLC. And even a 1-state Turing machine needs 4 or 5 elements in the tuple. – luser droog Nov 17 '12 at 18:49

HTML:

☺


It's not a really a programming language, but the shortest possible solution.

• While it no longer fits in the rules, I'll still give a +1 because I was rushing my question and did not think of this. – vsz Nov 8 '12 at 18:58
• If you want to call this php instead, like this answer, it would probably be okay under the new rules. – Matt Nov 8 '12 at 19:09
• PHP will output gibberish if you simply try to use ☺. – jdstankosky Nov 8 '12 at 19:37
• Works in HTML+CSS, which is okay under the new rules. – Adám Nov 15 '16 at 0:36

## plain-text, 1 char

☺


Because html is an overkill in many situations.

(yes, I know the rules have changed)

# Mathematica

Just for fun...

"\[HappySmiley]"
"\[NeutralSmiley]"
"\[FreakedSmiley]"


• In Mma, the one char ☺ also does it – Dr. belisarius Nov 11 '12 at 21:01
• @belisarius How do you paste without having it converted to ASCII? – DavidC Nov 11 '12 at 22:52
• I just copy-pasted it :) – Dr. belisarius Nov 11 '12 at 23:07
• @belisarius I also cut & pasted the icons, but for some reason the full format was shown. – DavidC Dec 16 '12 at 14:44
• The commercial value is roughly 75 cents. The mathematical value is zilch. – DavidC Aug 25 '13 at 22:03

## C, 18 chars

Far from beating Brainf**k, but as good as C can get (I guess).
Only works on little-endian platforms, must run without parameters.

main(c){puts(&c);}


# Micronetics System MUMPS 4.4 (7 chars)

w $c(1)  • MUMPS? Oh, the horror... I never even imagined that I'll see it here. +1 just for the pure shock value! – vsz Nov 9 '12 at 12:56 • @vsz it's the only Golf suitable language I know, it often beats most common langs :) – DaveShaw Nov 9 '12 at 12:59 ## Brainf*ck (only 2 characters) +.  • Of course, I'll still accept a solution of length 2. – vsz Nov 8 '12 at 18:55 • Could you explain how this works? It should output ASCII 1 which is a non-printable character. – nyuszika7h Oct 27 '14 at 13:58 • @nyuszika7h : many consoles output a smiley for ASCII 1. – vsz Oct 27 '14 at 19:19 • Really? I've never seen such a console. I bet they use some obscure charset. – nyuszika7h Oct 27 '14 at 19:21 Doesn't beat 2 chars, but: ## PHP 11 chars. <?=chr(1)?>  For everyone saying you can simply place the smiley in php and it will output ☺: Running it with php.exe in the command line gives Γÿǁ and placing it in the browser gives â˜º It does not work. • You could also go the HTML route that m0nhawk did. – Mr. Llama Nov 9 '12 at 17:35 • @GigaWatt You cannot. It puts out gibberish using PHP. Did you even try? I tried it in the CLI and the browser. – jdstankosky Nov 9 '12 at 17:48 • Works fine for me. ideone.com/6wYzx9 – Mr. Llama Nov 9 '12 at 17:56 • Running it with php.exe in the command line gives Γÿǁ and placing it in the browser gives â˜º – jdstankosky Nov 9 '12 at 18:56 • If you do a hex dump of your file, you'll see that it was saved as unicode representation of a smiley (\xE298BA), not as \x01. Try manually making a file with a single \x01 byte in it and running it from the command line with PHP. – Mr. Llama Nov 9 '12 at 21:04 # DC - 2 characters 1P  It doesn't require any explanation. # PHP (1) ☺  Technically this is a valid PHP file (a web server will happily serve it). ### Golfscript, 3 characters "☺"  Not a golfscript expert, but I don't believe there is a way to convert an integer into the corresponding ASCII character using only 1 character, so it seems like this is the shortest it can get # J (3 chars) '☺'  The code require appropriate font. According to Wikipedia In the Wingdings font, the letter "J" is rendered as a smiley face (note this is distinct from the Unicode code point U+263A, which renders as ☺). • Another variation is u:1. – FireFly Oct 8 '13 at 21:30 # Q/k (9 chars) Can't do it in 2 unfortunately. -1"\001";  I seem to recall a bug in an older version of the interpreter which produced the other smile symbol in less characters. I'll look it up. Edit: found the quirk. It only appears to work on windows versions of the interpreter: q)1(1b); ☺  # Ruby - 6 $><<?☺


\$> is stdout, << is the flux operator, and ?☺ is the same as '☺'

# LaTeX (51/77 characters)

Short solution

\documentclass{book}
\begin{document}
☺
\end{document}


Good solution (Compile with latex main.tex):

\documentclass{book}
\usepackage{wasysym}
\begin{document}
\smiley
\end{document}

• The first one does not work because pure LaTeX cannot read unicode chars. Oddly enough, this does not work neither in XeLaTeX, nor in LuaLaTeX because the default font table does not contain this symbol. Please consider this: \documentclass{book} \usepackage{fontspec} \setmainfont{DejaVu Sans} \begin{document}☺\end{document} — and please specify the rendering engine you are using (pdfLaTeX) in the “good” solution. – Andreï Kostyrka Nov 14 '16 at 16:57

# Burlesque - 6 Characters

,1L[sh

Explanation:

, pops stdin. 1L[ pushes one and convert to char (by codepoint) sh is used to switch to pretty format. (Otherwise it would print a leading ').

## Tcl, 1

☺


Displays a ☺ with some other stuff.
There are rumors that this also works with PHP or other languages.

## Arduino, 24

char a=1;Serial.print(a)


# Perl 6 (7 chars)

say '☺'


I'm bending the rules a little by assuming that a \n is welcome to avoid shell prompt mess.

• Are you sure you need that space character? – J B Aug 28 '13 at 21:46

# plain TeX (5 chars):

Other my answer, now on plain TeX:

☺\bye

• Does not work because pure TeX is ASCII-only. – Andreï Kostyrka Nov 14 '16 at 16:58

# JavaScript, 10 Bytes

alert("☺")


# SmileBASIC, 3 characters

?"☺


​​