Today (September 24) is HONDA birthday

10

1

today (24 of September) is birthday of company HONDA. Originally their company name is

本田技研工業株式会社

I want to ask to make a gift for HONDA. The task is to make program print company name. You can do it any way you want, but there is only one rule, Unicode is not allowed. It should be ASCII art.

I want to ask to post code and output. As always to determine winner I'll look at the length of code, however portrait in this case is also important.

EDIT: output have to look similar into this: 本田技研工業株式会社

ST3

Posted 2013-09-24T09:18:18.827

Reputation: 1 279

Question was closed 2015-11-06T23:19:37.210

Alright, so what's stopping us from using 'HONDA' and claiming it prints the company name in GolfScript? (I'm just trying to point out some loopholes). Also, is this meant to be tagged as [tag:code-golf]? – Volatility – 2013-09-24T09:27:16.160

@Volatility I've made edit after your comment. – ST3 – 2013-09-24T09:29:29.480

Unicode is not allowed where? At the output (sounds reasonable)? As script? As internal representation in your script? – Johannes Kuhn – 2013-09-24T10:14:49.407

@JohannesKuhn I meant none of printed characters cannot be UNICODE, in script you can use it but output should be on ASCII table chars. – ST3 – 2013-09-24T10:17:23.657

Ohh, then fine. – Johannes Kuhn – 2013-09-24T10:18:11.317

2The spec is too vague to allow an objective determination of whether a program meets it or not. – Peter Taylor – 2013-09-24T13:10:39.550

Ok, now we got a "Text->Image->Ascii Art" Question here. – Johannes Kuhn – 2013-09-24T20:06:50.083

Answers

20

Mathematica

Here the characters are individually rasterized. The zero's of the binary image data of a reduced image are then replaced with asterisks and the array itself is then printed.

GraphicsGrid[ImageData@ImageResize[Binarize@Rasterize@Style[#, 136], 30] 
/. {1 -> "", 0 -> "*"}] & /@ Characters["本田技研工業株式会社"]

Honda

Below all characters were rasterized as a single image. The asterisks are a bit more difficult to recognize as asterisks in this case.

GraphicsGrid[ImageData@ImageResize[Binarize@Rasterize@Style[#, 136], 300] 
/. {1 -> "",  0 -> "*"}, ImageSize -> 1500] &["本田技研工業株式会社"]

image2

DavidC

Posted 2013-09-24T09:18:18.827

Reputation: 24 524

Very, very nice – Dr. belisarius – 2013-09-26T01:04:34.857

Wow. Looks very good. One of the requirements was visual portrait and your solution has very high quality of that, so that's way I'm accepting your answer. – ST3 – 2013-09-26T12:11:56.520

11

Tcl

Well, a probably crazy approach.

package r Tk
package r Img
pack [label .l -text 本田技研工業株式会社 -fg #000000 -bg #ffffff]
update
puts [join [lmap line [[image create photo -data .l] data] {join [lmap pixel $line {expr {$pixel ne {#ffffff}?"@":" "}}] {}}] \n]
exit

Here a screenshot:

screenshot

Johannes Kuhn

Posted 2013-09-24T09:18:18.827

Reputation: 7 122

Does output same as 本田技研工業株式会社? – ST3 – 2013-09-24T10:38:01.490

Well and do not look very good, but all in all good solution. – ST3 – 2013-09-24T10:43:24.873

I don't output any unicode characters. I just take a photo of them and render that as Ascii. Well, b/w. – Johannes Kuhn – 2013-09-24T10:44:45.277

I could more different characters to display shades. (At the cost of the progam size) – Johannes Kuhn – 2013-09-24T10:46:22.080

6


JavaScript + HTML, interactive version (275 + 90 = 365 chars)

Many ideas inspired by Austin's answer, but this one is interactive; you can change the font size! (also the character count is actually correct)


Screenshot

Pressing the - and + buttons change the font size. Image is cut off, but you get the idea.

image


Fiddle (try it yourself!)

Here is a JSFiddle where you can run the code yourself.


JS, 275

h=30,(r=function(){for(x=document.createElement('canvas').getContext('2d'),x.font=h+'px sans-serif',x.fillText('本田技研工業株式会社',0,h),d=x.getImageData(0,0,w=h*10,h).data,s='',a=0;a<h;a++){for(b=0;b<w;b++)s+=d[3+w*4*a+4*b]?0:' ';s+='\n'}document.getElementById('p').innerHTML=s})()

HTML, 90

<button onclick='h--;r()'>-</button><button onclick='h++;r()'>+</button><pre id='p'></pre>

Hi-resolution version

http://jsfiddle.net/UjTbK/1/

image


Doorknob

Posted 2013-09-24T09:18:18.827

Reputation: 68 138

r=function(h){for(x=document.createElement('canvas').getContext('2d'),x.font=h+'px sans-serif',x.fillText('本田技研工業株式会社',0,h),d=x.getImageData(0,0,w=h*10,h).data,s='',a=0;a<h;a++){for(b=0;b<w;b++)s+=d[3+w*4*a+4*b]?0:' ';s+='\n'}document.getElementById('p').innerHTML=s} (30) is three bytes shorter. – Conor O'Brien – 2015-11-06T23:39:22.467

4

Javascript, 261 characters, 226 minified

special thanks to jsacii for inspiring this solution.

c = document.createElement('canvas').getContext('2d');
c.font="30px sans-serif";c.fillText("本田技研工業株式会社", 0,30);d=c.getImageData(0,0,305,40).data;
s="";
for(var y = 0; y<40;y+=2){
    for(var x=0;x<305;x++)
        s += d[3+4*x+1220*y]? "*" : " ";
    s+="\n";
}

minified

c=document.createElement("canvas").getContext("2d");c.font="30px sans-serif";c.fillText("本田技研工業株式会社",0,30);d=c.getImageData(0,0,305,40).data;s="";for(var y=0;y<40;y+=2){for(var x=0;x<305;x++)s+=d[3+4*x+1220*y]?"*":" ";s+="\n"}

and the output

             ****                                                ****        ****                                                                                ***  ***                ****        ****                           **                       ****                  ****         ****             
             ****               **************************       ****        ****          *****************************                                  ****   ***  ***   ****         ****    ********                          ********                 ******                 ****         ****             
             ****               **************************       ****        ****      *    ** ******* ****** ****** **    *************************       ****  ***  ***  ****          ****   **** ****                          **** *****             **********                ***         ****             
 ****************************   ****       ****       ****   ****************************     ****       ****   ****       ************************    ****************************  ***************************   ****************************        ******    ******        *************    ****             
  ***************************   ****       ****       ****   ***********     ****             ****       ****   ****                 ****                     ****      ****         ***************************   ****************************     *******        *******             ****     ****             
          *********             ****       ****       ****       ****        ****            ****        ****   ****                 ****               **************************      **********   ****                          ****          *****************************       *********************       
         ************           **************************       **** *****************     ****************************             ****               **************************      *************************    ******************          ****  ****************  *****      ****   **** **********       
       ***** **** ****          **************************       ******* ****      ****    ******  ********************              ****                 **********************       **************************    ******************                                           *******       ****             
      *****  ****  *****        ****       ****       ****   ********    *****   *****    *******  ***   ****   ****                 ****                 **********************      *******      ********               ****      ****         ****************************  *************    ****             
   ******    ****    ******     ****       ****       ****   ********      **** ****       * ****  ***   ****   ****                 ****              **************************** *********     ***********             ****      ****           *      ****     *      **   **** *** ****    ****             
 *****************************  ****       ****       ****       ****       *******          ****  ***  ****    ****                 ****              ****************************  **  ****   ********* *****           ****     * ****   ***          ****    *****              ***         ****             
 ****   *    ****        ****   ****       ****       ****       ****      *********         ********* *****    ****     ****************************        ****************            **********  ****  ******         *********** ****  ****        ****       *****            ***         ****             
             ****               **************************       ****  *******  *******      **************     ****     ****************************  **********  ****  ***********     ********    ****    ****  **************      ********    ***********************          ***  *******************     
             ****               ****                  ****   **************        *******   ****    *****      ****                                   ******      ****       *****      ****        ****           ***                 ******    ****************     *****       ****  *******************     
             ***                                                 *                     *              **         **                                                ****                  ****         ***                                                               **          ***                          

Professor Allman

Posted 2013-09-24T09:18:18.827

Reputation: 261

You can remove the var statements from the for loops and you can replace (if you want) "*" with a number. – Conor O'Brien – 2015-11-06T23:41:53.977

I think first output line should be fixed. – ST3 – 2013-09-24T19:13:31.867

That was just from pasting into the editor, fixed in edit – Professor Allman – 2013-09-24T19:14:58.437

That's 261 characters, by my count... – Doorknob – 2013-09-25T01:40:05.650

@Doorknob i posted the minified count, changed in update – Professor Allman – 2013-09-26T16:47:40.880

1

Java, 267 260 characters

Alright, I guess my solution is not all that different from Johannes Kuhn's answer, but as it seems this is a problem that can be handled nicely in Java; my solution is not much longer; and the output is slightly different, I'll post it nevertheless:

class A{public static void main(String[]a){java.awt.image.BufferedImage b=new java.awt.image.BufferedImage(130,16,2);b.createGraphics().drawString("本田技研工業株式会社",0,13);for(int y=0;y<2080;System.out.print((b.getRGB(y%130,y/130)<0?"#":" ")+(++y%130<1?"\n":"")));}}

Formatted as:

class A {
    public static void main(String[]a) {
        java.awt.image.BufferedImage b = new java.awt.image.BufferedImage(130, 16, 2);
        b.createGraphics().drawString("本田技研工業株式会社", 0, 13);
        for (int y = 0; y < 2080; System.out
                .print((b.getRGB(y % 130, y / 130) < 0 ? "#" : " ")
                        + (++y % 130 < 1 ? "\n" : "")))
            ;
    }
}

Output:

      #                     #     #                                   # #        #  # #                       #         #    #    
      #       ###########   #     #     #### #######                # # # #      #  # #            # ##      # #        #    #    
 ###########  #    #    #   #  ########   #   #  #    ##########  # # # # # #    #  ######         #       ##   ##    #####  #    
      #       #    #    # ####    #      #    #  #        #       ###########  ### #  #     ############  #       #       #  #    
     ###      #    #    #   #     #      #    #  #        #          #   #       #    #            #     # ######  ##    #  ##### 
    # # #     ###########   #  #######   ### #######      #       ###########   ### #######  ##### #                    #    #    
   #  #  #    #    #    #   ##  #   #   ## #  #  #        #        #########   # #    #        #   #                   ###   #    
  #   #   #   #    #    # ###    #  #    # #  #  #        #            #       # #   ###       #    #    ###########  # # #  #    
 #  #####  #  #    #    #   #    # #     # #  #  #        #       ###########  # #  # # #      #    #        #          #    #    
 #    #     # #    #    #   #    ###     ### #   #        #          # # #       # #  #  #     # ## #  #    #   #       #    #    
      #       ###########   #  ##   ##   # # #   #   ###########   ##  #  ###    # #  #   # #####    # #    #    #      # ####### 
      #       #         # ##  #       #      #   #                #    #     #   #    #               #  ######## ##    #         

memo

Posted 2013-09-24T09:18:18.827

Reputation: 21

@Bakuriu Use a different font. @ memo: you can save 6 characters by NOT importing. (importing costs 36 chars, using the full qualified name costs 15 chars for each use). – Johannes Kuhn – 2013-09-24T14:19:42.670

@Johannes Kuhn: You are absolutely right. I've updated the answer accordingly, and also found another redundant blank in the array declaration. – memo – 2013-09-24T14:40:38.410