Write ASCII-Art Obfuscated Code, read as, and resulting in: "DFTBA"

8

4

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

Brigand

Posted 2013-01-25T01:59:02.077

Reputation: 1 137

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. – captncraig – 2013-01-25T04:30:25.007

@CMP, revised, thanks :-) – Brigand – 2013-01-25T04:41:32.030

Do upper and lower case characters count separately (as different characters)? – Shmiddty – 2013-02-01T17:23:40.810

Also, what's to stop me from dumping random characters into the code that do nothing? Is that allowed? – Shmiddty – 2013-02-01T17:25:21.947

@Shmiddty, yes, all characters with different ascii codes (excluding whitespace). As long as it runs, that's fine :-) – Brigand – 2013-02-01T22:20:19.320

@FakeRainBrigand what about extended ASCII? http://www.asciitable.com/

– jwbensley – 2013-03-07T23:47:02.400

Characters 32-255 are allowed. – Brigand – 2013-03-08T00:45:58.887

@FakeRainBrigand I have posted a new answer for you using both standard and extended ASCII then. Cheers :) – jwbensley – 2013-03-10T22:51:25.780

Answers

6

(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+219=269

+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&Ž6H        ‘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        @@,

jwbensley

Posted 2013-01-25T01:59:02.077

Reputation: 251

Awesome answer! Definitley the high score, but one of us is counting incorrectly. I removed characters matching \s regex (whitespace), string to array |> unique |> length. – Brigand – 2014-06-02T13:02:51.467

Did you run that regex above the text above or the text on the website I linked, check there as the CodeGolf version of the code is not the same (it alters the code I paste in). – jwbensley – 2014-06-03T12:16:40.127

21

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

lochok

Posted 2013-01-25T01:59:02.077

Reputation: 3 139

Cool answer. So are al the letters except A ignored? – Brigand – 2013-02-07T08:56:21.520

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 – 2013-02-07T09:56:25.660

Oh, that's really cool. Nicely done :-) – Brigand – 2013-02-07T20:05:40.130

17

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.

marinus

Posted 2013-01-25T01:59:02.077

Reputation: 30 224

I looked into Malbolge a little... and I don't get it! :-) Would you mind explaining how this code works? – Brigand – 2013-01-26T22:23:43.340

@FakeRainBrigand: did so – marinus – 2013-01-28T23:37:49.223

I don't understand how 141 > 144. – Shmiddty – 2013-03-07T19:05:03.303

8

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

Shmiddty

Posted 2013-01-25T01:59:02.077

Reputation: 1 209

1Nice. 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. – Brigand – 2013-02-02T20:06:28.077

6

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

primo

Posted 2013-01-25T01:59:02.077

Reputation: 30 891

Awesome! I'm just counting 59 unique characters (after removing whitespace). – Brigand – 2013-01-25T13:29:10.843

@FakeRainBrigand oops, you're right. I just ran a count_char over it, and forgot to exclude whitespace. – primo – 2013-01-25T14:11:09.433

6

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");   /**/      }}}}

shamp00

Posted 2013-01-25T01:59:02.077

Reputation: 1 221

I'm impressed! It's not easy to do these when you have to create a class :-) – Brigand – 2013-04-11T18:11:37.917

6

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

jadkik94

Posted 2013-01-25T01:59:02.077

Reputation: 281

4

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(      );

ugoren

Posted 2013-01-25T01:59:02.077

Reputation: 16 527

3

Java

class  Ypnypn  {public  static    void
main(  String  []array  ){{}{}   {{{{}{
{   }  {          {     }    }   {    }
{   (  System     .     out).    print(
(   "  "          +     "    "   +    
"   "  +          "     DFTBA"   )    .
trim(  )          )     ;}}}}}   }    }

Ypnypn

Posted 2013-01-25T01:59:02.077

Reputation: 10 485

Definitely the best readability of all the answers. I'm out of votes today, but I'll be back. – bballdave025 – 2019-12-13T17:48:14.150