Take the 2-minute tour ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

The challenge is to write the most elaborate code, embedded in ASCII art that reads and prints "DFTBA". For example, the following reads DFTBA:

oooooooooo.   oooooooooooo ooooooooooooo oooooooooo.        .o.       
`888'   `Y8b  `888'     `8 8'   888   `8 `888'   `Y8b      .888.      
 888      888  888              888       888     888     .8"888.     
 888      888  888oooo8         888       888oooo888'    .8' `888.    
 888      888  888    "         888       888    `88b   .88ooo8888.   
 888     d88'  888              888       888    .88P  .8'     `888.  
o888bood8P'   o888o            o888o     o888bood8P'  o88o     o8888o 

And the following, in bash prints DFTBA

echo "DFTBA"

The challenge is to write one that does both.

Winning conditions

Valid answers, (all conditions at my discretion)

  • Can be clearly read as DFTBA
  • Print DFTBA when executed
  • Must be functional with no Internet connection
  • have letters of equal height
  • must not have more than 80 columns
  • must not have more than 10 rows

Points (highest sum wins)

  • Rows * Columns / 32
  • Readability: 25 for legible, 50 for very clear
  • 1 point for each different non-whitespace character used

Restrictions

These may be used for something, so all responses are assumed to be released into the public domain. If you can't, or choose not to release your answer into the public domain: post a comment/response to the original question saying "The answer authored and/or shared by me, may not be considered to be in the public domain".

Non-public domain answers are welcome too! Just make sure to specify :-)

What is DFTBA?

It sometimes stands for "Don't Forget To Be Awesome", but not always... Long story... This related song might help explain (or confuse).

share|improve this question
    
The winning criteria is really largest area? That will quickly turn into an arms race of people adding more and more worthless characters to get it bigger. There is really no upper bound on this. –  CMP Jan 25 '13 at 4:30
    
@CMP, revised, thanks :-) –  FakeRainBrigand Jan 25 '13 at 4:41
    
Do upper and lower case characters count separately (as different characters)? –  Shmiddty Feb 1 '13 at 17:23
    
Also, what's to stop me from dumping random characters into the code that do nothing? Is that allowed? –  Shmiddty Feb 1 '13 at 17:25
    
@Shmiddty, yes, all characters with different ascii codes (excluding whitespace). As long as it runs, that's fine :-) –  FakeRainBrigand Feb 1 '13 at 22:20
show 3 more comments

8 Answers

up vote 16 down vote accepted

Malbolge (71 80 x 10) / 32 + 25 + 94 = 141.1875 144

Update: added more spacing between the letters to raise the score.

Tested with the official Malbolge interpreter. Of course, it's really not hard to print static text using Malbolge. The encoding used by Malbolge almost guarantees you'll have the whole set of printable ASCII characters in there.

bCBA@?>=<;       :9876543210    /.-,+*)('&%$#    "!~}|{zyxwv            uts
rqp     onm      lkjihgfedcb    a`_^]\[ZYXWVU    TSR      QPO         NML KJI
HGF      EDC     BA@                 ?>=         <;:       987       654   321
0/.      -,+     *)(                 '&%         $#"      !~}       |{z     yxw
vuW       srq    ponmlkjihg`         &^]         #a`_A]\[TxX       WVU       TSR
QPO       N0L    KJIHGFEDCBA         @?>         =<;:3W16543       ,P0/.-,+*)('&
%$#      "!~     }|{                 zyx         wvu      tsr      qpo       nml
kji      hgf     edc                 ba`         _^]       \[Z     YXW       VUT
SRQ     PO1      lYK                 JIH         GFE      DCB      A@?       >=<
;:98765432       10/                 .-,         +*)('&%$#"!       ~}|       {zy

Explanation of the code (people said they didn't understand it):

(For more information about Malbolge see http://esolangs.org/wiki/Malbolge).

First, let's normalize the code to the operations given at the above page:

iooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
*ooooooooooooop<pp<ooo*ooop<ooooooooooo*ooooooooooooooooooop<poooop<oo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*<vooooo
oooooooooooooooooooooooooooooooooooooooooooo

Also note that after each instruction cycle, the executed instruction is re-encoded and the code pointer and the data pointer are increased by 1.

  • At the beginning, C (code ptr) = D (data ptr) = 0. This means [D] = 'b' (98) and the i instruction is selected. So we jump to address 99. (C is first set to 98 and then increased), the data pointer is now 1.

  • At 98 there's a string of NOPs (o). These do have the effect that they are all re-encoded and that C and D are incremented. The next real instruction (*) is found at address 140, so now C=140 and D=42.

  • * does a right rotate (or division by three) on what the data pointer's pointing at, and stores back into the memory and in the accumulator A. [42] = 'x' (120), so A <- [42] <- '(' (40).

  • Another row of NOPs causes C=154 (p) and D=62 ( [D]='j' (106) ).

  • p is the crazy operator. I'm not going to reproduce its table here, but what happens is A = [D] = crazy(A, [D]). A is still 42, [D] is 106, which means crazy(A, [D]) = 29504.

  • Next up is <, which is output. It outputs the accumulator, which is 29504, as an ASCII character. 29504 % 256 = 68, which is D, so now we have the D.
  • The rest of the letters are output in a similar manner.
share|improve this answer
    
I looked into Malbolge a little... and I don't get it! :-) Would you mind explaining how this code works? –  FakeRainBrigand Jan 26 '13 at 22:23
    
@FakeRainBrigand: did so –  marinus Jan 28 '13 at 23:37
    
Thanks, I half get it :-) –  FakeRainBrigand Jan 29 '13 at 3:06
    
I don't understand how 141 > 144. –  Shmiddty Mar 7 '13 at 19:05
add comment

Piet, Score Uncertain (153ish)

Piet Program

I understand that this doesn't strictly fit within the specifications (requiring ASCII art), however the source code does provide a very readable DFTBA. The trace is below.

Piet ignores every colour that doesn't mean anything. As a result, I used gray as the generic "comment colour" to outline and the like. The gray doesn't get interpreted (as you'll see in the trace). I wanted to make it clear which pixels were in the program and which were not.

I've used 15 colours, which is 13 without whitespce. It is 89x32 pixels, though could be compressed more. I used 4 op-codes (subtract, divide, push and outputc). Maybe if using scoring how I would think, 153?

Probably doesn't warrant a score, but was an interesting exercise. Having never used Piet before, I've never done so much trial-and-error programming! I needed npiet extensively, and its trace. I still can't figure out how the movement of the cursor works with any stability!

How it works:

  • D, F, T are constants for their respective ASCII letters that are then pushed to the stack, and the OUTC command called
  • B is the ASCII for B x 2 (needed to be to look good), which is pushed to the stack, then divided by two, then duplicated on the stack and the OUTC command called
  • Note the earlier duplication. That was because I couldn't make A look good in so few characters. I push 1 to the stack, subtract (making the ASCII code for A) and then the whole A character is the opcode for OUTC - doesn't matter the size, because it's an operation not a constant

Trace

share|improve this answer
    
Cool answer. So are al the letters except A ignored? –  FakeRainBrigand Feb 7 '13 at 8:56
    
Actually - each letter is the constant of that letter (except A). The area of each letter is the constant. Hence why they're slightly weird looking :) –  lochok Feb 7 '13 at 9:56
    
Oh, that's really cool. Nicely done :-) –  FakeRainBrigand Feb 7 '13 at 20:05
add comment

Javascript (80 x 10) / 32 + 25? + 94 = 144

Code:

eval('for(i      =10;i<0x24;42,  Number["prot"+  "otype"][(i++    ).toString(36\
)]=Number["p"    +"rototype"]/*  */["toString"]  );alert(((+((-   ~{}).a()+(!!{\
}+!!{}+!!{}).b   ())).c(+((+!!{  }).d()+(5).e()  ))+(     +((+!!  {}).f()+(2+!!\
{}+!      !{}+!  !{}).               g())).      h(+(      (+!!   {}).      i()\
+(7)       .j()  ))+(+((2)           .k()+(      /*TVEXFGHZKJP    Q*/(      0x1\
+0x1       +0x1  )*0x3).l(           ))).m(      +((8/4+1).n()+   (+[]).o\()))+\
(+((      +!!{}  ).p()+(-~           {}).q(      ))).      r(+((  +!!{}).s()+(!\
!{}+2/*WARP*/)   .t()                ))+(+(      (+!!     {}).u(  )+(+      [])\
.v())).w(+((+    !!{}                ).y()+      (2/*Y*/).z()))   )/**      **/\
.toUpperCase     ());                "#$%\'      /,:>?@^_`9|&M    ODLB      I"')

Demo: http://jsfiddle.net/4hyyS/3/

To add some explanation:

First I map Number.prototype.toString to each lower-case letter:

for(i=10;i<36;Number.prototype[(i++).toString(36)] = Number.prototype.toString);

This allows me to use the lowercase letters efficiently.

Next I construct the string 'DFTBA' by converting numbers to characters, eg:

(13).a(15) // 'd'

(I could have used fromCharCode or toString(36) for all of the characters, but that would have been too easy)

To fill out extra characters, and further obfuscate the code, I use a few tricks to create the numbers:

+[]        // 0
+!!{}      // 1
!!{}+!!{}  // 2

Etc.

For characters that aren't used in the actual code, I dropped them in either comment blocks /* ... */ or strings " ... ".

I started off with an 80x10 grid, then whittled that down to my letters, then adjusted my code to fit that (also, looks better in this font, the last | is just the cursor):

Looks better in a different font

share|improve this answer
1  
Nice. If there was any way to smooth out the B it would be better (it's borderline 8). So the score looks right to me. –  FakeRainBrigand Feb 2 '13 at 20:06
add comment

Perl (75 x 7) / 32 + 25 + 59 ≈ 107.4

@D=('-4*x^2      8*x^5-72*x^3  56*x^4-260*x^1  +272*x^6',         '
4*x^2    -4*x'   );$b++   ,s/  (-)  ?(\w  +)(  .x)?    (\^       \d+
 )?/      "\$$b   \[0$4             ||$2       $3<1    ]$1=     $2^I"
 .!"       $$O"   /exgemfor         +@D;       $P=pop@2;$K     =(  pop
 @1)       /+$P   and               $_.=       chr(    --$j   ?"$K*x^$j"
:"+"     .$K),    s/^               \+|\       +\B|    \b1\   *|\    ^1$/
/gx,map$1[$      j++]-=            $_*$K,      @2while$j=    @1-@2  ;print

I'd tell you what it does, but that'd ruin the obfu, wouldn't it ;)

share|improve this answer
    
Awesome! I'm just counting 59 unique characters (after removing whitespace). –  FakeRainBrigand Jan 25 '13 at 13:29
    
@FakeRainBrigand oops, you're right. I just ran a count_char over it, and forgot to exclude whitespace. –  primo Jan 25 '13 at 14:11
add comment

(I have made a full write up here as it is quite extensive how I got to these two results)

Brainfuck, Full ASCII range 0 to 255: 80x10=800/32=25+25+222=272

+l+A+O#@e@        /+@+|+2+@@X     @*3+}+@+@YZ    q4[@>@+@@           @:+@
@+B+"+~@@N        @p+K+%>@@v@     dJ+w+@+@+@@    I@+@+@+@@         (@+  @<@
@<@      @-@      @@]                 U>@        @-@    -@@f      @.r    +@E
+@@       .@@0    @>@+@+@+@@@         @+@        @.@    <@@@      @-'    -@@
-€R       -9‚     ƒ.„-….†$c‡ˆ         ‰Š‹        Œg&Ž6H        ‘h’“7”i•–—
˜u™       Qš1›    MœL                 )nG        ?žŸ x¡¢£        `¤¥¦j@§{D¨
!©ª       «P¬­    ®bm                 ¬¯°        ±²³    ´µ\¶     ·¸F      ¹8º
»S¼      ½¾¿      ÀVÁ                 ÂTà        ÄÅk    _ÆÇÈ     ÉÊË      ÌÍÎ
ÏaÐ;ÑCÒÓsÔ        ÕÖ×                 ØoÙ        ÚÛ=Ü5ÝÞßà      áâã        äåæ
çtèéê^ëìíî        Wïð                 ñòó        ôõö÷yøùúû      üýz        þÿ,

There is a line through the middle of this top one which is not quite strait, but that is just the display here on CodeGolf. If you download the original file from the above link and view it in the Brainfuck Developer or Notepad instead of Wordpad for example, it will look correct like this.

Brainfuck, Part ASCII range 0 to 127: 80x10=800/32=25+25+95=145

+l+A+O#@e@         /+@+|+2+@@X     @*3+}+@+@YZ    q4[@>@+@@           @:+@
@+B+"+~@@N         @p+K+%>@@v@     dJ+w+@+@+@@    I@+@+@+@@         (@+  @<@
@<@      @-@       @@]                 U>@        @-@    -@@f      @.r    +@E
+@@       .@@0     @>@+@+@+@@@         @+@        @.@    <@@@      @-'    -@@
-@R       -9@@     @.@-@.@$c@@         @@@        @@g&@@6@H        @h@@7@i@@@
@u@       Q@1@     M@L                 )nG        @?@@@x@@@        `@@@j@@{D@
!@@       @P@@     @bm                 ¬@@        @@@    @@\@     @@F      @8@
@S@      @@@       @V@                 @T@        @@k    _@@@     @@@      @@@
@a@;@C@@s@         @@@                 @o@        @@=@5@@@@      @@@        @@@
@t@@@^@@@@         W@@                 @@@        @@@@y@@@@      @@z        @@,
share|improve this answer
add comment

C#, (71*7)/32+25+45 = 85.53

My first Programming Puzzles answer! C# is really not very good for these games...

/**/using/*    */System;/*  */namespace   F{class//oo.        .o.       
 //8'   `Y8b  `888'             8888      `888'    `Y8b      .888.      
 //8      888  888              8888       888      888     .8"888.     
 /*8      8*/  I{static         void       Main(string     []  args    
 ) {      /*8  888    "         8888       888     `88*/   {Console.   
 //8     d88'  888              8888       888     .88P  .8'     `888.  
WriteLine(     /*88             8888      */"DFTBA");   /**/      }}}}
share|improve this answer
    
I'm impressed! It's not easy to do these when you have to create a class :-) –  FakeRainBrigand Apr 11 '13 at 18:11
add comment

Python, (69*7)/32 + 25 + 49 = 89

oo=getattr;   o=__import__ ('sys');O='s' 'tdout';#o.        .o.
class    Y8b  :#88'     `8 8'   888   `8 `888'   `Y8b      .888.
 #88      888  888              888       888     888     .8"888.
 def      a88  (Oo,oO):         oo(       oo(o,O),'w'    'r'  'it'
 "e"      )((  (oO    )         ));       11/    0b10   ;return[88,
 88]     #d8`  888              888       888    .88P  .8'     `888.
d=Y8b().a88;  d("D"            "FT")     +[1]+d("BA"  '\n'     )#1880

It's not easy to do it in Python because of indentation and whitespace. So I did one of many things to make the indentation legit:

  • defined a class
  • used concatenation of strings
  • list with a trailing comma
  • line continuation character (which I ended up not using)

Readability can still be improved a bit...

share|improve this answer
add comment

C, (55*8)/32+25+55 = 93.35

It's quite easy to make the letters larger, and use a few more characters.

main()    {p(O(O(O(  O(O(O(O(O(  O(O(O(O(O       (O
(p(O(O(   p()))))))  ))))))))))  ));puts(""     ,p(o
(p    (o  (o             (o      (o      (o    (o  (o
(o    (o  (o             (o      (o      (o   (o    (o
(o    (o  (o())))))      ))      ))))))))    ))))));}x=
59    ;O  ()             {x      ++      ;}  o(      ){
+x    --  ;}             p(      ){      ;;  ;;      ;;
putchar   (x             +9      );x;-x;}    q(      );
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.