Write language name in 3D ASCII
![Task](http://static.miraheze.org/rosettacodewiki/thumb/b/ba/Rcode-button-task-crushed.png/64px-Rcode-button-task-crushed.png)
You are encouraged to solve this task according to the task description, using any language you may know.
- Task
Write/display a language's name in 3D ASCII.
(We can leave the definition of "3D ASCII" fuzzy,
so long as the result is interesting or amusing,
not a cheap hack to satisfy the task.)
- Related tasks
360 Assembly
3D EBCDIC. This program does nothing clever in any way: it just prints out strings. <lang 360asm>THREED CSECT
STM 14,12,12(13) BALR 12,0 USING *,12 XPRNT =CL23'0 ####. #. ###.',23 XPRNT =CL24'1 #. #. #. #.',24 XPRNT =CL24'1 ##. # ##. #. #.',24 XPRNT =CL24'1 #. #. #. #. #.',24 XPRNT =CL23'1 ####. ###. ###.',23 LM 14,12,12(13) BR 14 LTORG END</lang>
- Output:
####. #. ###. #. #. #. #. ##. # ##. #. #. #. #. #. #. #. ####. ###. ###.
Ada
Quotes are not escaped by \ in ada (nor does \ have any meaning in strings), so this turns out highlighting funny. <lang Ada>with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings.Fixed; use Ada.Strings.Fixed; procedure AsciiArt is
art : constant array(1..27) of String(1..14) := (1=>" /\\\\\\ ", 2=>" /\\\", 3|6|9=>" ", 4|12=>" /\\\\\\\\\\ ", 5|8|11=>" \/\\\", 7|17|21=>" /\\\//////\\\", 10|19|20|22=>"\/\\\ \/\\\", 13|23|24=>"\/\\\\\\\\\\\\", 14|18=>" /\\\\\\\\\\\", 15=>" \/////////\\\", 16=>"\/\\\//////\\\", 25=>"\/// \/// ", 26|27=>"\//////////// ");
begin
for i in art'Range loop Put(art(i)&' '); if i mod 3 = 0 then New_Line; Put(i/3*' '); end if; end loop;
end AsciiArt;</lang>
- Output:
/\\\\\\ /\\\ /\\\\\\\\\\ \/\\\ /\\\//////\\\ \/\\\ \/\\\ \/\\\ \/\\\ /\\\\\\\\\\ \/\\\\\\\\\\\\ /\\\\\\\\\\\ \/////////\\\ \/\\\//////\\\ /\\\//////\\\ /\\\\\\\\\\\ \/\\\ \/\\\ \/\\\ \/\\\ /\\\//////\\\ \/\\\ \/\\\ \/\\\\\\\\\\\\ \/\\\\\\\\\\\\ \/// \/// \//////////// \////////////
AutoHotkey
<lang autohotkey>AutoTrim, Off draw = (
______ __ __ __ __
/\ __ \/\ \_\ \/\ \/ / \ \ __ \ \ __ \ \ _"-.
\ \_\ \_\ \_\ \_\ \_\ \_\ \/_/\/_/\/_/\/_/\/_/\/_/
) Gui, +ToolWindow Gui, Color, 1A1A1A, 1A1A1A Gui, Font, s8 cLime w800, Courier New Gui, Add, text, x4 y0 , % " " draw Gui, Show, w192 h82, AHK in 3D return
GuiClose: ExitApp</lang>
- Output:
______ __ __ __ __ /\ __ \/\ \_\ \/\ \/ / \ \ __ \ \ __ \ \ _"-. \ \_\ \_\ \_\ \_\ \_\ \_\ \/_/\/_/\/_/\/_/\/_/\/_/
AWK
<lang AWK>
- syntax: GAWK -f WRITE_LANGUAGE_NAME_IN_3D_ASCII.AWK
BEGIN {
arr[1] = " xxxx x x x x" arr[2] = "x x x x x x" arr[3] = "x x x x x x" arr[4] = "xxxxxx x x xx" arr[5] = "x x x xx x xx" arr[6] = "x x xx xx x x" arr[7] = "x x xx xx x x" arr[8] = "A V P J B W" for (i=1; i<=8; i++) { x = arr[i] gsub(/./,"& ",x) gsub(/[xA-Z] /,"_/",x) print(x) } exit(0)
} </lang>
- Output:
_/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/_/_/ _/ _/ _/_/ _/ _/ _/ _/_/ _/ _/_/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
Batch File
<lang batch>@echo off echo ****** ** ** echo /*////** /** /** echo /* /** ****** ****** ***** /** echo /****** //////** ///**/ **///**/****** echo /*//// ** ******* /** /** // /**///** echo /* /** **////** /** /** **/** /** echo /******* //******** //** //***** /** /** echo /////// //////// // ///// // // </lang>
BASIC
Applesoft BASIC
Ported from ZX Spectrum Basic.<lang ApplesoftBasic>10 S$ = "BASIC" : REM OUR LANGUAGE NAME 20 DIM B(5,5) : REM OUR BIGMAP CHARACTERS 30 FOR L = 1 TO 5 : REM 5 CHARACTERS 40 FOR M = 1 TO 5 : REM 5 ROWS 50 READ B(L,M) 60 NEXT M, L
100 GR : REM BLACK BACKGROUND 110 COLOR = 1 : REM OUR SHADOW WILL BE RED 120 HOME : REM CLS 130 R = 9 : REM SHADOW WILL START ON ROW 5 140 C = 2 : REM SHADOW WILL START AT COLUMN 2 150 GOSUB 2000"DRAW SHADOW 160 COLOR = 13 : REM OUR FOREGROUND WILL BE YELLOW 170 R = 10 : REM FOREGROUND WILL START ON ROW 6 180 C = 3 : REM FOREGROUND WILL START ON COLUMN 3 190 GOSUB 2000"DISPLAY THE LANGUAGE NAME
999 STOP
1000 REM CONVERT TO BINARY BIGMAP 1010 T = N : REM TEMPORARY VARIABLE 1020 G$ = "" : REM THIS WILL CONTAIN OUR 5 CHARACTER BINARY BIGMAP 1040 FOR Z = 5 TO 0 STEP -1 1050 D$ = " " : REM ASSUME NEXT DIGIT IS ZERO (DRAW A SPACE) 1055 S = 2 ^ Z 1060 IF T >= S THEN D$ = "*" : T = T - S : REM IS A BLOCK 1070 G$ = G$ + D$ 1080 NEXT Z 1090 RETURN
2000 REM DISPLAY THE BIG LETTERS 2010 FOR L = 1 TO 5 : REM OUR 5 ROWS 2020 X = C : Y = R + L - 1 : REM PRINT AT R+L-1,C; 2030 FOR M = 1 TO 5 : REM BIGMAP FOR EACH CHARACTER 2040 N = B(M, L) 2050 GOSUB 1000 2060 FOR I = 1 TO LEN(G$) : IF MID$(G$, I, 1) <> " " THEN PLOT X,Y :REM 5 CHARACTER BIGMAP 2070 X = X + 1 : NEXT I 2080 X = X + 1 : REM PRINT " ";: REM SPACE BETWEEN EACH LETTER 2090 NEXT M, L 2100 RETURN
9000 DATA 30,17,30,17,30: REM B 9010 DATA 14,17,31,17,17: REM A 9020 DATA 15,16,14,1,30: REM S 9030 DATA 31,4,4,4,31: REM I 9040 DATA 14,17,16,17,14: REM C </lang>
BBC BASIC
Uses the built-in BBC Micro-compatible character generator, so any text can be specified. <lang bbcbasic> PROC3dname("BBC BASIC")
END DEF PROC3dname(name$) LOCAL A%, X%, Y%, char%, row%, patt%, bit% DIM X% 8 : A% = 10 : Y% = X% DIV 256 FOR row% = 1 TO 8 FOR char% = 1 TO LEN(name$) ?X% = ASCMID$(name$,char%) CALL &FFF1 patt% = X%?row% FOR bit% = 7 TO 0 STEP -1 CASE TRUE OF WHEN (patt% AND 2^bit%) <> 0 : PRINT "#"; WHEN GET$(POS-1,VPOS-1) = "#": PRINT "\"; OTHERWISE: PRINT " "; ENDCASE NEXT NEXT char% PRINT NEXT row% ENDPROC</lang>
- Output:
##### ##### #### ##### #### #### ###### #### ##\\## ##\\## ##\\## ##\\## ##\\## ##\\## \##\\\ ##\\## ##\ ##\ ##\ ##\ ##\ \\ ##\ ##\ ##\ ##\ ##\ \\ ##\ ##\ \\ #####\\ #####\\ ##\ #####\\ ######\ #### ##\ ##\ ##\\## ##\\## ##\ ##\\## ##\\##\ \\## ##\ ##\ ##\ ##\ ##\ ##\ ##\ ## ##\ ##\ ##\ ##\ ## ##\ ##\ ##\ ## #####\\ #####\\ ####\\ #####\\ ##\ ##\ ####\\ ###### ####\\ \\\\\ \\\\\ \\\\ \\\\\ \\ \\ \\\\ \\\\\\ \\\\
FreeBASIC
freebasic is quite a long name, so I have done a combi. <lang FreeBASIC>dim as integer yres=hiword(width) dim as integer xres=loword(width)
- define map(a,b,x,c,d) ((d)-(c))*((x)-(a))/((b)-(a))+(c)
- define _X(num) int( map(0,xres,(num),0,loword(width)))
- define _Y(num) int( map(0,yres,(num),0,hiword(width)))
Type pt
As Integer x,y
End Type Dim As pt a(1 To ...)=_ {(4,2),(6,2),(8,2),(12,2),(14,2),(16,2),(20,2),(22,2),(24,2),(28,2),(30,2),(32,2),_ (4,3),(12,3),(16,3),(20,3),(28,3),_ (4,4),(6,4),(12,4),(14,4),(16,4),(20,4),(22,4),(28,4),(30,4),_ (4,5),(12,5),(20,5),(28,5),_ (4,6),(12,6),(16,6),(20,6),(22,6),(24,6),(28,6),(30,6),(32,6)}
For i As Integer=0 To 12
For n As Integer=Lbound(a) To Ubound(a) Locate _Y(a(n).y+i),_X(a(n).x+i) If i<12 Then Print "\" Else Print "#" Next n
Next i locate(csrlin-1,40) print "BASIC" Sleep </lang>
- Output:
\ \ \ \ \ \ \ \ \ \ \ \ \\ \ \ \\ \\\ \\ \ \ \\ \ \ \\\ \ \ \\\ \\\ \\\ \ \ \\\ \ \ \\\\ \ \\\\\ \\\\\\\ \ \\\\\ \ \ \\\\\ \ \\\\\ \\\\\\\ \ \\\\\ \ \ \\\\\ \ \\\\\ \\\\\\\ \ \\\\\ \ \ \\\\\ \ \\\\\ \\\\\\\ \ \\\\\ \ \ \\\\\ \ \\\\\ \\\\\\\ \ \\\\\ \ \ \\\\\ \ \\\\\ \\\\\\\ \ \\\\\ \ \ \\\\\ \ \\\\\ \\\\\\\ \ \\\\\ \ \ \\\\\ \ \\\\\ \\\\\\\ \ \\\\\ \ \ \\\\\ \ \\\\\ \\\\\\\ \ \\\\\ \ \ \\\\# # #\\\# #\#\\\# # #\\\# # # \\\#\ \\\#\ \#\\\#\ \\\#\ \\# # \\# # # \\# # \\# # \# \# \ \#\ \ \#\ \ # # # # # # BASIC
Liberty BASIC
<lang lb> r=21:s=9:c=s For i=1 To 11
Read d If d <> 0 Then For j=1 To 31 If (d And(2^(31-j)))>0 Then Locate c+1,r:Print "___"; Locate c,r+1:Print "/_ /|"; Locate c,r+2:Print "[_]/"; End If c=c+3 Next Else s=1:c=s End If r=r-2:s=s+2:c=s Next
Data 479667712,311470336,485697536,311699712,476292608,0,1976518785,1160267905,1171157123,1160267909,1171223529 </lang>
- Output:
___ ___ _________ ____________ _________ _______________ ___ ___ /_ /| /_ /| /_ /_ /_ /| /_ /_ /_ /_ /| /_ /_ /_ /| /_ /_ /_ /_ /_ /| /_ /| /_ /| _[_]/ _[_]/ _[_][_][_]/_ _[_][_][_][_]/ _[_][_][_]/_ [_][_][_][_][_]/ [_]/_ _[_]/ /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| _[_]/ _[_]/ _[_]/____ [_]/ _[_]/____ _[_]/____ [_]/ _[_]/ [_]/__[_]/ /_ /| /_ /| /_ /_ /_ /| /_ /_ /_ /| /_ /_ /_ /| /_ /| /_ /_ /| _[_]/ _[_]/ _[_][_][_]/_ _[_][_][_]/ _[_][_][_]/_ _[_]/ [_][_]/ /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| _[_]/____ _[_]/ _[_]/____ [_]/ _[_]/_______ _[_]/ _[_]/ _[_]/ _[_]/ /_ /_ /_ /| /_ /| /_ /_ /_ /| /_ /_ /_ /_ /| /_ /| /_ /| /_ /| /_ /| [_][_][_]/ [_]/ [_][_][_]/ [_][_][_][_]/ [_]/ [_]/ [_]/ [_]/ _________ ______ _________ ___ ______ /_ /_ /_ /| /_ /_ /| /_ /_ /_ /| /_ /| /_ /_ /| _[_][_][_]/_ ___ [_][_]/_ ___ [_][_][_]/ _[_]/ ___ [_][_]/_ /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| _[_]/____ [_]/ _[_]/_____[_]/ [_]/____ _[_]/ _[_]/ [_]/ /_ /_ /_ /| /_ /_ /_ /_ /| /_ /_ /| /_ /| /_ /| _[_][_][_]/_ _[_][_][_][_]/ [_][_]/_ _[_]/ _[_]/ ___ /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| /_ /| _[_]/____ [_]/ _[_]/ _[_]/ _________ [_]/ _[_]/ [_]/____ [_]/ /_ /_ /_ /| /_ /| /_ /| /_ /_ /_ /| /_ /| /_ /_ /| [_][_][_]/ [_]/ [_]/ [_][_][_]/ [_]/ [_][_]/
Locomotive Basic
<lang locobasic>10 mode 2:defint a-z 20 locate 1,25 30 print "Basic"; 40 ' add some kerning so the characters will fit in 80 columns: 50 off(2)=1:off(4)=-2:off(5)=-4 60 for c=0 to 4 70 for y=7 to 0 step -1 80 for x=0 to 7 90 v=test(x+8*c,2*y) 100 plot x+8*c,2*y,0 110 if v>0 then gosub 180 120 next x 130 next y 140 next c 150 call &bb06 ' wait for key press 160 end 170 ' print pixel 180 xp=16*c+2*x+1+y+off(c+1) 190 yp=8-y 200 if xp>77 then return 210 locate xp,yp 220 print "//\"; 230 locate xp,yp+1 240 print "\\/"; 250 return</lang>
- Output:
////////////\ ////\ \////\\\\////\ \\\\/ ////\/ ////\/ ////////\ ////////\ //////\ ////////\ //////////\\\/ \\\\\////\ ////\\\\\\\/ \////\/ ////\\\\////\ ////\\\\////\ //////////\/ \////////\ ////\/ ////\/ \\\\/ ////\/ ////\/ ////\\\\////\/ \\\\\////\ ////\/ ////\/ ////\ ////////////\\\/ \//////\\////\ //////////\\\/ ////////\ \////////\\\/ \\\\\\\\\\\\/ \\\\\\/ \\\\/ \\\\\\\\\\/ \\\\\\\\/ \\\\\\\\/
TI-83 BASIC
<lang ti83b>Disp “ .....+ .....+ Disp “ +o+ooo +o+ooo Disp “ .o .o Disp “ .o ...+.+ Disp “ +o +ooooo Disp “ Disp “ BASIC</lang>
Replace . + o with 0x81,0x80,and 0x7F http://tibasicdev.wikidot.com/one-byte-tokens These can be found in the Catalog (2ND 0) menu, near the end
ZX Spectrum Basic
We have used an extended (non-ASCII) character in this example to produce an inverted space symbol (143 on the spectrum character table), for simplicity. We could substitute another character, and change the handler to cause a colour switch using a traditional space (ascii 32), but the output would still look the same. Fixed the error and removed the need for 2^z. <lang zxbasic> 10 DIM b(5,5): REM our bigmap characters
20 FOR l=1 TO 5: REM 5 characters 30 FOR m=1 TO 5: REM 5 rows 40 READ b(m,l) 50 NEXT m 60 NEXT l 70 PAPER 0: BORDER 0: REM black background and border 80 INK 2: REM our shadow will be red 90 CLS 100 LET r=8: REM shadow will start on row 8 110 LET c=1: REM shadow will start at column 1 120 GO SUB 2000: REM draw shadow 130 INK 6: REM our foreground will be yellow 140 LET r=9: REM foreground will start on row 9 150 LET c=2: REM foreground will start on column 2 160 GO SUB 2000: REM display the language name 999 STOP
1000 REM convert to binary bigmap 1010 LET z=16 1020 IF t>=z THEN PRINT AT r+l-1,c+c1;CHR$ (143);: LET t=t-z: REM 143 is a block 1040 LET c1=c1+1: LET z=z/2 1050 IF z>=1 THEN GO TO 1020 1060 RETURN 2000 REM display the big letters 2010 FOR l=1 TO 5: LET c1=0: REM our 5 rows 2030 FOR m=1 TO 5: REM bigmap for each character 2040 LET t=b(l,m) 2050 GO SUB 1000 2060 LET c1=c1+1: REM PRINT " ";: REM space between each letter 2070 NEXT m 2080 NEXT l 2090 RETURN 9000 DATA 30,17,30,17,30: REM B 9010 DATA 14,17,31,17,17: REM A 9020 DATA 15,16,14,1,30: REM S 9030 DATA 31,4,4,4,31: REM I 9040 DATA 14,17,16,17,14: REM C</lang>
To me it does not work. So I bring my particular solution:
<lang zxbasic>5 PAPER 0: CLS 10 LET d=0: INK 1: GO SUB 40 20 LET d=1: INK 6: GO SUB 40 30 STOP 40 RESTORE 50 FOR n=1 TO 5 60 READ a$ 70 FOR j=1 TO LEN a$ 80 PRINT AT n+7,j+5+d; 90 IF a$(j)="X" THEN PRINT CHR$ 143: REM Equivalent to 219 in ASCII extended for IBM PC 100 NEXT j 110 NEXT n 120 RETURN 130 DATA "XXX XXXX XXX X XXX" 140 DATA "X X X X X X X " 150 DATA "XXX XXXX XXX X X " 160 DATA "X X X X X X X " 170 DATA "XXX X X XXX X XXX"</lang>
Befunge
Befunge-93
<lang Befunge>0" &7&%h&'&%| &7&%7%&%&'&%&'&%&7&%"v v"'%$%'%$%3$%$%7% 0%&7&%&7&(%$%'%$"< >"%$%7%$%&%$%&'&%7%$%7%$%, '&+(%$%"v v"+&'&%+('%$%$%'%$%$%$%$%$%$%$%'%$"< >"(%$%$%'%$%$%( %$+(%&%$+(%&%$+(%&"v v"(; $%$%(+$%&%(+$%$%'%$%+&%$%$%$%"< ? ";(;(+(+$%+(%&(;(3%$%&$ 7`+( ":v > ^v!:-1<\,:g7+*63%4 \/_#4:_v#:-*84_$@ $_\:,\^ >55+,$:^:$</lang>
- Output:
__ _____ /\ \____ ______ /\ __\ __ __ ______ ______ ______ \ \ __ \/\ __ \ \_\ \__/\ \ \ \/\ __ \/\ __ \/\ __ \ \ \ \_\ \ \ __/_/\__ _\ \ \_\ \ \ \ \ \ \ \_\ \ \ __/_ \ \_____\ \_____\/_/\ \/\ \_____\ \_\ \_\ \____ \ \_____\ \/_____/\/_____/ \ \_\ \/_____/\/_/\/_/\/\_____\/_____/ \/_/ \/_____/
Befunge-98
Bit of a long one,but it works and it does something other than taking strings and simply copying to STDOUT. (It adds line offset to those strings,and the strings are encoded with numbers just because.)
<lang Befunge> v THE DATA IMAGE.(totally useless after loading into stack) >89 v Made by gamemanj v0000122010000000000022201220000020000< For rosettacode >9 v The 'image' is upsidedown v2220100010002220101000101000000000000< The 3d offset isn't applied on this >9 v and it's encoded weirdly v1010122012001010101022201220000010000< Is that enough decoding needed >9 v for the '3d' ascii requirement? v2220100010001010222010101000000010000< Huh.(sees Batch) I think so. >9 v 0:blank v1000122012200000000022201220000010000< 1:\ >9 v 2:- v p000< 9:newline >:9-v Check for 9:Newline 8:end
v_v (note that cell 0,0 isn't ever used after the first tick!) no yes | | >" ",v >$55+,00g1+:00p:|: -1< Newline With Spacing Encoder
^ v# $<
: 8 check for end no-yes v_v >< make the program pause for the user forever.Ik,it's stupid
Numeric Decoder \/ >:1-v v_vCheck for 1 '\' NO: "YES 2 \ - " v_ >v " "
^ -
" "
^ $,< < < (code path reuse here,all 3 end in ,$ so I merged them) </lang>
- Output:
\ \-- \-- --- \-- \ --- \ \ \ \ --- \ \ \ \ \ \ \-- \- \ \ \ \ --- \-- \ --- \ \ --- \ \ \ \ \-- \ --- \-- -
Brainf***
Coming up with decent 3D font was honestly the hardest part. <lang bf>++++[>++++>++<[>>++>+++>++++++> ++++++<<<<<-]<-]>>++>..>->----> -...[<]<+++[>++++[>>...<<-]<-]> >>..>>>.....<<<..>>>...[<]++[>> .....>>>...<<<<<-]>.>.>.>.<<..> >.[<]<+++++[>++++[>>.<<-]<-]>>> ..>>>...[<]+++++[>>..<<-]+++>>. >.<..>>>...<.[[>]<.<.<<..>>.>.. <<<.<<-]+++>.>.>>.<<.>>.<<..>>. >....<<<.>>>...<<<..>>>...<<<.> >>......<<.>.>..<.<<..>>>..<<<. .>>>....<.<<..>>.>..<<.[[>]<<.> ..<<<...>>>.<.<<<<-]+++>.>..>>. <<.>>.<<...>>>..<<<.>>..<<..>>. <.<.>>>..<..>...<<<...>>.<<.>>> .<<.>>.<<.<..>>.<.<.>>>.<<<..>> .>.<<<...>>>..<.>.<<.>.>..<.<.. >>.<<.>.>..<.<..>>.<<.>.>..<.<. <<.>...>>.<<.>>.<<..>>.<.>.<<.> >..<<...>.>>..<<..>>...<.<<...> >..<<..>>..<<...>.<.>>.<<..>>.. <<..>>.>.<<.<[[>]<<<<.>>.<.>>.. <<.<..<<-]>.>....>>.<<.>>.<<..> >.>.<.<<.>>..<<..>>.<<...>.>.<< ..>>>.<<<....>>..<<..>>..<<..>> ..<<.>>.<<..>>..<<..>>.<<<.>... ..>>.<<.>>.>......<..>..<.<<..> >.<<.>>.>...<<.>.>..<..>..<..>. .<..<<.>>.>..<..>..<.<<<.>..... .>>.<.>>......<<..>>..<<.<...>> .<.>>..<<.>.<.>>..<<..>>..<<..> >..<<.<.>>.<.>>..<<..>>..<<.<<.</lang>
- Output:
___ _____ ___ ___ ___ /\ \ ___ / ___\_\ \__ _\ \__ _\ \__ \ \ \____ ___ ___ ______/\__\ __ ____\ \__/\__ _\\__ _\\__ _\ \ \ __ \\ \/ __\\___ \ _/_/ \/ _ \_ __\_/\__\//_/\__\//_/\__\/ \ \ \/\ \\ /__//___\ \\ \\ / \ \\ \_/ \/__/ \/__/ \/__/ \ \ \_\ \\ \ /\ _ \\ \\ \\ \ \\ \ \ \______\\__\ \ \___/\__\\__\\__\\ \__\\__\ \/______//__/ \/__/\/__//__//__/ \/__//__/
C
3D enough?<lang c>#include <stdio.h> const char*s = " _____\n /____/\\\n/ ___\\/\n\\ \\/__/\n \\____/"; int main(){ puts(s); return 0; }</lang>
- Output:
_____ /____/\ / ___\/ \ \/__/ \____/
C++
<lang cpp>
- include <windows.h>
- include <iostream>
//-------------------------------------------------------------------------------------------------- using namespace std;
//-------------------------------------------------------------------------------------------------- int main(int argc, char* argv[]) { cout << " ______ ______ " << endl << " _____ _____|\\ \\ _____|\\ \\ " << endl << " _____\\ \\_ / / | | / / | |" << endl << " / /| || |/ /|| |/ /|" << endl << " / / /____/|| |\\____/ || |\\____/ |" << endl << "| | |____|/ |\\ \\ | / |\\ \\ | / " << endl << "| | _____ | \\ \\___|/ | \\ \\___|/ " << endl << "|\\ \\|\\ \\ | \\ \\ | \\ \\ " << endl << "| \\_____\\| | \\ \\_____\\ \\ \\_____\\ " << endl << "| | /____/| \\ | | \\ | | " << endl << " \\|_____| || \\|_____| \\|_____| " << endl << " |____|/ ";
cout << endl << endl << endl;
system( "pause" ); return 0; } //-------------------------------------------------------------------------------------------------- </lang>
- Output:
______ ______ _____ _____|\ \ _____|\ \ _____\ \_ / / | | / / | | / /| || |/ /|| |/ /| / / /____/|| |\____/ || |\____/ | | | |____|/ |\ \ | / |\ \ | / | | _____ | \ \___|/ | \ \___|/ |\ \|\ \ | \ \ | \ \ | \_____\| | \ \_____\ \ \_____\ | | /____/| \ | | \ | | \|_____| || \|_____| \|_____| |____|/
Another solution: <lang cpp> // @author Martin Ettl (http://www.martinettl.de) // @date 2013-07-26 // A program to print the letters 'CPP' in 3D ASCII-art.
- include <iostream>
- include <string>
int main() {
std::string strAscii3D = " /$$$$$$ /$$$$$$$ /$$$$$$$ \n" " /$$__ $$| $$__ $$| $$__ $$\n" "| $$ \\__/| $$ \\ $$| $$ \\ $$\n" "| $$ | $$$$$$$/| $$$$$$$/\n" "| $$ | $$____/ | $$____/ \n" "| $$ $$| $$ | $$ \n" "| $$$$$$/| $$ | $$ \n" " \\______/ |__/ |__/ \n";
std::cout << "\n" << strAscii3D << std::endl; return 0;
} </lang>
- Output:
/$$$$$$ /$$$$$$$ /$$$$$$$ /$$__ $$| $$__ $$| $$__ $$ | $$ \__/| $$ \ $$| $$ \ $$ | $$ | $$$$$$$/| $$$$$$$/ | $$ | $$____/ | $$____/ | $$ $$| $$ | $$ | $$$$$$/| $$ | $$ \______/ |__/ |__/
C#
<lang csharp>using System; using System.Text;
namespace Language_name_in_3D_ascii {
public class F5 { char[] z = { ' ', ' ', '_', '/', }; long[,] f ={ {87381,87381,87381,87381,87381,87381,87381,}, {349525,375733,742837,742837,375733,349525,349525,}, {742741,768853,742837,742837,768853,349525,349525,}, {349525,375733,742741,742741,375733,349525,349525,}, {349621,375733,742837,742837,375733,349525,349525,}, {349525,375637,768949,742741,375733,349525,349525,}, {351157,374101,768949,374101,374101,349525,349525,}, {349525,375733,742837,742837,375733,349621,351157,}, {742741,768853,742837,742837,742837,349525,349525,}, {181,85,181,181,181,85,85,}, {1461,1365,1461,1461,1461,1461,2901,}, {742741,744277,767317,744277,742837,349525,349525,}, {181,181,181,181,181,85,85,}, {1431655765,3149249365L,3042661813L,3042661813L,3042661813L,1431655765,1431655765,}, {349525,768853,742837,742837,742837,349525,349525,}, {349525,375637,742837,742837,375637,349525,349525,}, {349525,768853,742837,742837,768853,742741,742741,}, {349525,375733,742837,742837,375733,349621,349621,}, {349525,744373,767317,742741,742741,349525,349525,}, {349525,375733,767317,351157,768853,349525,349525,}, {374101,768949,374101,374101,351157,349525,349525,}, {349525,742837,742837,742837,375733,349525,349525,}, {5592405,11883957,11883957,5987157,5616981,5592405,5592405,}, {366503875925L,778827027893L,778827027893L,392374737749L,368114513237L,366503875925L,366503875925L,}, {349525,742837,375637,742837,742837,349525,349525,}, {349525,742837,742837,742837,375733,349621,375637,}, {349525,768949,351061,374101,768949,349525,349525,}, {375637,742837,768949,742837,742837,349525,349525,}, {768853,742837,768853,742837,768853,349525,349525,}, {375733,742741,742741,742741,375733,349525,349525,}, {192213,185709,185709,185709,192213,87381,87381,}, {1817525,1791317,1817429,1791317,1817525,1398101,1398101,}, {768949,742741,768853,742741,742741,349525,349525,}, {375733,742741,744373,742837,375733,349525,349525,}, {742837,742837,768949,742837,742837,349525,349525,}, {48053,23381,23381,23381,48053,21845,21845,}, {349621,349621,349621,742837,375637,349525,349525,}, {742837,744277,767317,744277,742837,349525,349525,}, {742741,742741,742741,742741,768949,349525,349525,}, {11883957,12278709,11908533,11883957,11883957,5592405,5592405,}, {11883957,12277173,11908533,11885493,11883957,5592405,5592405,}, {375637,742837,742837,742837,375637,349525,349525,}, {768853,742837,768853,742741,742741,349525,349525,}, {6010197,11885397,11909973,11885397,6010293,5592405,5592405,}, {768853,742837,768853,742837,742837,349525,349525,}, {375733,742741,375637,349621,768853,349525,349525,}, {12303285,5616981,5616981,5616981,5616981,5592405,5592405,}, {742837,742837,742837,742837,375637,349525,349525,}, {11883957,11883957,11883957,5987157,5616981,5592405,5592405,}, {3042268597L,3042268597L,3042661813L,1532713813,1437971797,1431655765,1431655765,}, {11883957,5987157,5616981,5987157,11883957,5592405,5592405,}, {11883957,5987157,5616981,5616981,5616981,5592405,5592405,}, {12303285,5593941,5616981,5985621,12303285,5592405,5592405,} };
private F5(string s) { StringBuilder[] o = new StringBuilder[7]; for (int i = 0; i < 7; i++) o[i] = new StringBuilder(); for (int i = 0, l = s.Length; i < l; i++) { int c = s[i]; if (65 <= c && c <= 90) c -= 39; else if (97 <= c && c <= 122) c -= 97; else c = -1; long[] d = new long[7]; Buffer.BlockCopy(f, (++c * sizeof(long) * 7), d, 0, 7 * sizeof(long)); for (int j = 0; j < 7; j++) { StringBuilder b = new StringBuilder(); long v = d[j]; while (v > 0) { b.Append(z[(int)(v & 3)]); v >>= 2; } char[] charArray = b.ToString().ToCharArray(); Array.Reverse(charArray); o[j].Append(new string(charArray)); } } for (int i = 0; i < 7; i++) { for (int j = 0; j < 7 - i; j++) System.Console.Write(' '); System.Console.WriteLine(o[i]); } }
public static void Main(string[] args) { new F5(args.Length > 0 ? args[0] : "C sharp"); } }
}</lang>
Output:
_/_/_/ _/ _/ _/_/_/ _/_/_/ _/_/_/ _/ _/_/ _/_/_/ _/ _/_/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/ _/_/_/ _/ _/
Clojure
<lang clojure>(use 'clj-figlet.core) (println
(render-to-string (load-flf "ftp://ftp.figlet.org/pub/figlet/fonts/contributed/larry3d.flf") "Clojure"))</lang>
- Output:
____ ___ /\ _`\ /\_ \ __ \ \ \/\_\ \//\ \ ___ /\_\ __ __ _ __ __ \ \ \/_/_ \ \ \ / __`\ \/\ \ /\ \/\ \ /\`'__\ /'__`\ \ \ \L\ \ \_\ \_ /\ \L\ \ \ \ \ \ \ \_\ \\ \ \/ /\ __/ \ \____/ /\____\\ \____/ _\ \ \ \ \____/ \ \_\ \ \____\ \/___/ \/____/ \/___/ /\ \_\ \ \/___/ \/_/ \/____/ \ \____/ \/___/
COBOL
This displays 'COBOL' in 3D with a shadow effect. The font is 'Slant Relief' from here.
<lang cobol> IDENTIFICATION DIVISION.
PROGRAM-ID. cobol-3d.
DATA DIVISION. WORKING-STORAGE SECTION. 01 cobol-area. 03 cobol-text-data PIC X(1030) VALUE "________/\\\\\\\\\____ - "____/\\\\\________/\\\\\\\\\\\\\__________/\\\\\________ - "/\\\_____________ _____/\\\////////_______/\\\// - "/\\\_____\/\\\/////////\\\______/\\\///\\\_____\/\\\____ - "_________ ___/\\\/______________/\\\/__\///\\\__ - "_\/\\\_______\/\\\____/\\\/__\///\\\___\/\\\____________ - "_ __/\\\_______________/\\\______\//\\\__\/\\\\\ - "\\\\\\\\\____/\\\______\//\\\__\/\\\_____________ - " _\/\\\______________\/\\\_______\/\\\__\/\\\/////////\\\ - "__\/\\\_______\/\\\__\/\\\_____________ _\//\\\_ - "____________\//\\\______/\\\___\/\\\_______\/\\\__\//\\\ - "______/\\\___\/\\\_____________ __\///\\\_______ - "_____\///\\\__/\\\_____\/\\\_______\/\\\___\///\\\__/\\\ - "_____\/\\\_____________ ____\////\\\\\\\\\_____\ - "///\\\\\/______\/\\\\\\\\\\\\\/______\///\\\\\/______\/\ - "\\\\\\\\\\\\\\_ _______\/////////________\/////_ - "_______\/////////////__________\/////________\////////// - "/////__" *> " Sorry for the syntax highlighting. . 03 cobol-text-table REDEFINES cobol-text-data. 05 cobol-text PIC X(103) OCCURS 10 TIMES.
01 i PIC 99. 01 j PIC 9(4).
PROCEDURE DIVISION. *> Display 'COBOL' line-by-line applying a shadow effect. PERFORM VARYING i FROM 1 BY 1 UNTIL 10 < i MOVE 1 TO j PERFORM UNTIL 103 < j *> When the top of a letter meets the right edge, *> take care to shadow only the wall ('/'). IF cobol-text (i) (j:4) = "\\\/" DISPLAY cobol-text (i) (j:3) AT LINE i COL j WITH FOREGROUND-COLOR 7, HIGHLIGHT ADD 3 TO j DISPLAY cobol-text (i) (j:1) AT LINE i COL j WITH FOREGROUND-COLOR 0, HIGHLIGHT
ADD 1 TO j EXIT PERFORM CYCLE END-IF *> Apply shadows to the walls, base and the char *> before the base. IF cobol-text (i) (j:1) = "/" OR cobol-text (i) (FUNCTION SUM(j, 1):1) = "/" OR cobol-text (i) (FUNCTION SUM(j, 1):2) = "\/" DISPLAY cobol-text (i) (j:1) AT LINE i COL j WITH FOREGROUND-COLOR 0, HIGHLIGHT *> Do not apply a shadow to anything else. ELSE DISPLAY cobol-text (i) (j:1) AT LINE i COL j WITH FOREGROUND-COLOR 7 , HIGHLIGHT END-IF
ADD 1 TO j END-PERFORM END-PERFORM
*> Prompt the user so that they have a chance to see the *> ASCII art, as sometimes the screen data is overwritten by *> what was on the console before starting the program. DISPLAY "Press enter to stop appreciating COBOL in 3D." AT LINE 11 COL 1 ACCEPT i AT LINE 11 COL 46
GOBACK .</lang>
- Output:
(note
_______'''_/'''\\\\\\\\\_______'''_/'''\\\\\_______'''_/'''\\\\\\\\\\\\\_________'''_/'''\\\\\_______'''_/'''\\\_____________ ____'''_/'''\\\'''////////'''______'''_/'''\\\'''///'''\\\____'''_\/'''\\\'''/////////'''\\\_____'''_/'''\\\'''///'''\\\____'''_\/'''\\\_____________ __'''_/'''\\\'''/'''_____________'''_/'''\\\'''/'''_'''_\///'''\\\__'''_\/'''\\\______'''_\/'''\\\___'''_/'''\\\/_'''_\///'''\\\__'''_\/'''\\\_____________ _'''_/'''\\\______________'''_/'''\\\_____'''_\//'''\\\_'''_\/'''\\\\\\\\\\\\\\___'''_/'''\\\_____'''_\/'''/\\\_'''_\/'''\\\_____________ '''_\/'''\\\_____________'''_\/'''\\\______'''_\/'''\\\_'''_\/'''\\\'''/////////'''\\\_'''_\/'''\\\______'''_\/'''\\\_'''_\/'''\\\_____________ '''_\//'''\\\____________'''_\//'''\\\_____'''_/'''\\\__'''_\/'''\\\______'''_\/'''\\\_'''_\//'''\\\_____'''_/'''\\\__'''_\/'''\\\_____________ _'''_\///'''\\\___________'''_\///'''\\\_'''_/'''\\\____'''_\/'''\\\______'''_\/'''\\\__'''_\///'''\\\_'''_/'''\\\____'''_\/'''\\\_____________ ___'''_\////'''\\\\\\\\\____'''_\///'''\\\\\/_____'''_\/'''\\\\\\\\\\\\\'''/'''_____'''_\///'''\\\\\'''/'''_____'''_\/'''\\\\\\\\\\\\\\\_ ______'''_\/////////'''_______'''_\/////'''_______'''_\/////////////'''_________'''_\/////'''_______'''_\///////////////'''__ Press enter to stop appreciating COBOL in 3D.
Common Lisp
<lang lisp> (ql:quickload :cl-ppcre) (defvar txt "
xxxx xxxx x x x x xxxx x x x x xxxx xxxxx
x x x x xx xx xx xx x x xx x x x x x x x x x x xx x x xx x x x x x x x x xxx x x x x x x x x x x x x x x x x xxx xxxxx x x x x x x x x x x x xx x x x x x
xxxx xxxx x x x x xxxx x x xxxxx x xxxx x
" ) (princ (cl-ppcre:regex-replace-all " " (cl-ppcre:regex-replace-all "x" txt "_/") " " )) </lang>
- Output:
_/_/_/_/ _/_/_/_/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/_/_/_/ _/_/_/_/_/ _/ _/ _/ _/ _/_/ _/_/ _/_/ _/_/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/_/_/_/ _/_/_/_/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/_/_/_/_/ _/ _/_/_/_/ _/
D
This generates a single image ASCII stereogram. <lang d>// Derived from AA3D - ASCII art stereogram generator // by Jan Hubicka and Thomas Marsh // (GNU General Public License) // http://aa-project.sourceforge.net/aa3d/ // http://en.wikipedia.org/wiki/ASCII_stereogram
import std.stdio, std.string, std.random;
immutable image = "
111111111111111 1111111111111111 11111 1111 11111 1111 11111 1111 11111 1111 11111 1111 11111 1111 1111111111111111 111111111111111
";
void main() {
enum int width = 50; immutable text = "DLanguage"; enum int skip = 12;
char[65536 / 2] data;
foreach (y, row; image.splitLines()) { immutable int shift = uniform(0, int.max); bool l = false;
foreach (x; 0 .. width) { int s; if (!l && x > skip) { s = (x < row.length) ? row[x] : '\n'; if (s == ' ') { s = 0; } else if (s == '\n') { s = 0; l = true; } else if (s >= '0' && s <= '9') { s = '0' - s; } else s = -2; } else s = 0;
s += skip; s = x - s; s = (s < 0) ? text[(x + shift) % text.length] : data[s]; data[x] = cast(char)s; write(data[x]); }
writeln(); }
}</lang>
- Output:
nguageDLangunguageDLangunguageDLangunguageDLangung DLanguageDLaDLangugeDLaDLangugeDLLaDLangugeDLLaDLa nguageDLangunguageLangunguageLanguunguageLanguungu LanguageDLanLanguagDLanLLanguagLanLLLanguagLanLLLa eDLanguageDLeDLangugeDLeeDLangugDLeeeDLangugDLeeeD guageDLanguaguageDLnguagguageDLnuaggguageDLnuagggu LanguageDLanLanguagDLanLLanguagDanLLLanguagDanLLLa nguageDLangunguageDangunnguageDagunnnguageDagunnng LanguageDLanLanguagDLanLLanguagLanLLLanguagLanLLLa nguageDLangunguageLangunguageLanguunguageLanguungu geDLanguageDgeDLanuageDgeDLanuageeDgeDLanuageeDgeD guageDLanguaguageDLanguaguageDLanguaguageDLanguagu
Dart
<lang dart> void main(){
print("""
XXX XX XXX XXXX X X X X X X X X X XXXX XXX X XXX X X X X X """.replaceAll('X','_/'));
} </lang>
- Output:
_/_/_/ _/_/ _/_/_/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/_/_/ _/ _/_/_/ _/ _/ _/ _/ _/
Elixir
<lang elixir>defmodule ASCII3D do
def decode(str) do Regex.scan(~r/(\d+)(\D+)/, str) |> Enum.map_join(fn[_,n,s] -> String.duplicate(s, String.to_integer(n)) end) |> String.replace("B", "\\") # Backslash end
end
data = "1 12_4 2_1\n1/B2 9_1B2 1/2B 3 2_18 2_1\nB2 B8_1/ 3 B2 1/B_B4 2_6 2_2 1/B_B6 4_1 3 B7_3 4 B2/_2 1/2B_1_2 1/B_B B2/_4 1/ 3_1B\n 2 B2 6_1B3 3 B2 1/B2 B1/_/B_B3/ 2 1/2B 1 /B B2_1/ 2 3 B5_1/4 6 B3 1B/_/2 /1_2 6 B1\n3 3 B10_6 B3 3 /2B_1_6 B1 4 2 B11_2B 1B_B2 B1_B 3 /1B/_/B_B2 B B_B1\n6 1B/11_1/3 B/_/2 3 B/_/" IO.puts ASCII3D.decode(data)</lang>
- Output:
____________ __ /\ _________\ /\ \ __ __ \ \ \________/ \ \ \ /\_\ __ __ /\_\ ____ \ \ \_______ \ \ \ \/_/_ /\_\__ /\_\ \/_/_ / ___\ \ \ ______\ \ \ \ /\ \ \/_/\_\/ / / /\ \ /\ \__/ \ \ \_____/ \ \ \ \ \ \ \/_/ / /_ \ \ \ \ \ \ \ \ \__________ \ \ \ \ \ \ / / /\_\__ \ \ \ \ \ \ \ \___________\ \ \_\ \ \_\ / / /\/_/\_\ \ \_\ \ \_\ \/___________/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_/
Erlang
<lang erlang>%% Implemented by Arjun Sunel -module(three_d). -export([main/0]).
main() -> io:format(" _____ _ \n| ___| | | \n| |__ _ __| | __ _ _ __ __ _ \n| __| '__| |/ _` | '_ \\ / _` |\n| |__| | | | (_| | | | | (_| |\n|____/_| |_|\\__,_|_| |_|\\__, |\n __/ |\n |___/\n"). </lang>
- Output:
_____ _ | ___| | | | |__ _ __| | __ _ _ __ __ _ | __| '__| |/ _` | '_ \ / _` | | |__| | | | (_| | | | | (_| | |____/_| |_|\__,_|_| |_|\__, | __/ | |___/
3D ASCII:
<lang erlang>-module(ascii3d). -export([decode/1]).
decode(Str) ->
Splited = re:split(Str, "(\\d+)(\\D+)", [{return,list},group,trim]), Fun = fun([_,N,S]) -> {Num,_} = string:to_integer(N), lists:duplicate(Num, S) end, Joined = string:join(lists:flatmap(Fun, Splited), ""), Lines = binary:replace(binary:list_to_bin(Joined), <<"B">>, <<"\\">>, [global]), io:format("~s~n", [Lines]).</lang>
- Output:
1> c("ascii3d.erl"). {ok,ascii3d} 2> Str = "1 11_10 2_1\n1/B2 8_1B8 1/B B\n2B 1B7_1/7 3 B1\n3 B7_6 3_3B 3 6_2 2_2 4_4 6_1\n2 2B 1 6_1B4 1/ 3_3B 1 / 4_1 B/B B/ 2_1 B2 1/ 4_1 B\n2 3 B5_1/3 1/B B2_1/B2 B1/B B2_1/3B 1 /_2/B B2_1/B B\n3 3 B8_3B 1 5 B1_B/ 8 B1_B/ B\n4 2 B10_1B B_B3 2B B_3_1/2B_B 2B B_3_1/B B\n6 1B/10_1/B/_/4 1B/_/B/3_2/B/_1/2 1B/_/B/3_1/2B 1B\n55 3_1B/2 1)\n54 1/B5_1/\n54 1B/4_1/\n". "1 11_10 2_1\n1/B2 8_1B8 1/B B\n2B 1B7_1/7 3 B1\n3 B7_6 3_3B 3 6_2 2_2 4_4 6_1\n2 2B 1 6_1B4 1/ 3_3B 1 / 4_1 B/B B/ 2_1 B2 1/ 4_1 B\n2 3 B5_1/3 1/B B2_1/B2 B1/B B2_1/3B 1 /_2/B B2_1/B B\n3 3 B8_3B 1 5 B1_B/ 8 B1_B/ B\n4 2 B10_1B B_B3 2B B_3_1/2B_B 2B B_3_1/B B\n6 1B/10_1/B/_/4 1B/_/B/3_2/B/_1/2 1B/_/B/3_1/2B 1B\n55 3_1B/2 1)\n54 1/B5_1/\n54 1B/4_1/\n" 3> ascii3d:decode(Str). ___________ __ /\ ________\ /\ \ \ \ \_______/ \ \ \ \ \ \_______ ___\ \ \ ______ __ ____ ______ \ \ ______\ / ___\ \ \ / ____ \/\ \/ __ \ / ____ \ \ \ \_____/ /\ \__/\ \ \/\ \__/\ \ \ /_/\ \/\ \__/\ \ \ \ \________\ \ \ \ \ \ \ \_\/ \ \ \ \ \ \ \ \_\/ \ \ \__________\ \_\ \ \_\ \____/\_\ \_\ \ \_\ \____/\ \ \/__________/\/_/ \/_/\/___/\/_/\/_/ \/_/\/___/\ \ \ ___\/ ) /\_____/ \/____/ ok
ERRE
<lang ERRE>PROGRAM 3D_NAME
DIM TBL$[17,1]
BEGIN
FOR I=0 TO 17 DO
READ(TBL$[I,0],TBL$[I,1])
END FOR
PRINT(CHR$(12);) ! CLS
FOR I=0 TO 17 DO
PRINT(TBL$[I,1];TBL$[I,0];TBL$[I,0];TBL$[I,1])
END FOR
DATA("_________________ ","_____________ ") DATA("|\ \ ","|\ \ ") DATA("|\\_______________\ ","|\\___________\ ") DATA("|\\| \ ","|\\| | ") DATA("|\\| ________ | ","|\\| ________| ") DATA("|\\| | |\| | ","|\\| | ") DATA("|\\| |______|\| | ","|\\| |____ ") DATA("|\\| | \| | ","|\\| | \ ") DATA("|\\| |________| | ","|\\| |_____\ ") DATA("|\\| | ","|\\| | ") DATA("|\\| ___ ____/ ","|\\| _____| ") DATA("|\\| | \\\ \ ","|\\| | ") DATA("|\\| | \\\ \ ","|\\| | ") DATA("|\\| | \\\ \ ","|\\| |______ ") DATA("|\\| | \\\ \ ","|\\| | \ ") DATA("|\\| | \\\ \ ","|\\| |_______\ ") DATA(" \\| | \\\ \ "," \\| | ") DATA(" \|___| \\\___\"," \|___________| ")
END PROGRAM </lang>
- Output:
_____________ _________________ _________________ _____________ |\ \ |\ \ |\ \ |\ \ |\\___________\ |\\_______________\ |\\_______________\ |\\___________\ |\\| | |\\| \ |\\| \ |\\| | |\\| ________| |\\| ________ | |\\| ________ | |\\| ________| |\\| | |\\| | |\| | |\\| | |\| | |\\| | |\\| |____ |\\| |______|\| | |\\| |______|\| | |\\| |____ |\\| | \ |\\| | \| | |\\| | \| | |\\| | \ |\\| |_____\ |\\| |________| | |\\| |________| | |\\| |_____\ |\\| | |\\| | |\\| | |\\| | |\\| _____| |\\| ___ ____/ |\\| ___ ____/ |\\| _____| |\\| | |\\| | \\\ \ |\\| | \\\ \ |\\| | |\\| | |\\| | \\\ \ |\\| | \\\ \ |\\| | |\\| |______ |\\| | \\\ \ |\\| | \\\ \ |\\| |______ |\\| | \ |\\| | \\\ \ |\\| | \\\ \ |\\| | \ |\\| |_______\ |\\| | \\\ \ |\\| | \\\ \ |\\| |_______\ \\| | \\| | \\\ \ \\| | \\\ \ \\| | \|___________| \|___| \\\___\ \|___| \\\___\ \|___________|
F#
<lang fsharp>let make2Darray (picture : string list) =
let maxY = picture.Length let maxX = picture |> List.maxBy String.length |> String.length let arr = (fun y x -> if picture.[y].Length <= x then ' ' else picture.[y].[x]) |> Array2D.init maxY maxX (arr, maxY, maxX)
let (cube, cy, cx) =
[ @"///\"; @"\\\/"; ] |> make2Darray
let (p2, my, mx) =
[ "*****"; "* * * "; "* * * "; "* **********"; "**** * * "; "* * * "; "* **********"; "* * * "; "* * * "; ] |> make2Darray
let a2 = Array2D.create (cy/2 * (my+1)) (cx/2 * mx + my) ' '
let imax = my * (cy/2) for y in 0 .. Array2D.length1 p2 - 1 do
for x in 0 .. Array2D.length2 p2 - 1 do let indent = Math.Max(imax - y, 0) if p2.[y, x] = '*' then Array2D.blit cube 0 0 a2 y (indent+x) cy cx
Array2D.iteri (fun y x c ->
if x = 0 then printfn "" printf "%c" c) a2
</lang>
- Output:
///////\ ///\\\\\/ ///\ ///\ ///\/ ///\////\/ ///\/ ////////////\ //////\ \///\\///\\\/ ///\\\\/ ///\////\/ ///\/ ////////////\ ///\/ \///\\///\\\/ ///\/ ///\////\/ \\\/ \\\/ \\\/
Forth
Text strings
<lang FORTH>\ Rossetta Code Write language name in 3D ASCII \ Simple Method
- l1 ." /\\\\\\\\\\\\\ /\\\\ /\\\\\\\ /\\\\\\\\\\\\\ /\\\ /\\\" CR ;
- l2 ." \/\\\///////// /\\\//\\\ /\\\/////\\\ \//////\\\//// \/\\\ \/\\\" CR ;
- l3 ." \/\\\ /\\\/ \///\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\" CR ;
- l4 ." \/\\\\\\\\\ /\\\ \//\\\ \/\\\\\\\\\/ \/\\\ \/\\\\\\\\\\\\\" CR ;
- l5 ." \/\\\///// \/\\\ \/\\\ \/\\\////\\\ \/\\\ \/\\\///////\\\" CR ;
- l6 ." \/\\\ \//\\\ /\\\ \/\\\ \//\\\ \/\\\ \/\\\ \/\\\" CR ;
- l7 ." \/\\\ \///\\\ /\\\ \/\\\ \//\\\ \/\\\ \/\\\ \/\\\" CR ;
- l8 ." \/\\\ \///\\\\/ \/\\\ \//\\\ \/\\\ \/\\\ \/\\\" CR ;
- l9 ." \/// \//// \/// \/// \/// \/// \///" CR ;
- "FORTH" cr L1 L2 L3 L4 L5 L6 L7 L8 l9 ;
( test at the console ) page "forth" </lang>
- Output:
/\\\\\\\\\\\\\ /\\\\ /\\\\\\\ /\\\\\\\\\\\\\ /\\\ /\\\ \/\\\///////// /\\\//\\\ /\\\/////\\\ \//////\\\//// \/\\\ \/\\\ \/\\\ /\\\/ \///\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\\\\\\\ /\\\ \//\\\ \/\\\\\\\\\/ \/\\\ \/\\\\\\\\\\\\\ \/\\\///// \/\\\ \/\\\ \/\\\////\\\ \/\\\ \/\\\///////\\\ \/\\\ \//\\\ /\\\ \/\\\ \//\\\ \/\\\ \/\\\ \/\\\ \/\\\ \///\\\ /\\\ \/\\\ \//\\\ \/\\\ \/\\\ \/\\\ \/\\\ \///\\\\/ \/\\\ \//\\\ \/\\\ \/\\\ \/\\\ \/// \//// \/// \/// \/// \/// \/// ok
Bit Matrix Method
<lang FORTH>\ Original code: "Short phrases with BIG Characters by Wil Baden 2003-02-23 \ Modified BFox for simple 3D presentation 2015-07-14
\ Forth is a very low level language but by using primitive operations \ we create new words in the language to solve the problem.
\ This solution coverts an acsii string to big text characters
HEX
- toUpper ( char -- char ) 05F and ;
- w, ( n -- ) CSWAP , ; \ compile 'n', a 16 bit integer, into memory in the correct order
CREATE Banner-Matrix
0000 w, 0000 w, 0000 w, 0000 w, 2020 w, 2020 w, 2000 w, 2000 w, 5050 w, 5000 w, 0000 w, 0000 w, 5050 w, F850 w, F850 w, 5000 w, 2078 w, A070 w, 28F0 w, 2000 w, C0C8 w, 1020 w, 4098 w, 1800 w, 40A0 w, A040 w, A890 w, 6800 w, 3030 w, 1020 w, 0000 w, 0000 w, 2040 w, 8080 w, 8040 w, 2000 w, 2010 w, 0808 w, 0810 w, 2000 w, 20A8 w, 7020 w, 70A8 w, 2000 w, 0020 w, 2070 w, 2020 w, 0000 w, 0000 w, 0030 w, 3010 w, 2000 w, 0000 w, 0070 w, 0000 w, 0000 w, 0000 w, 0000 w, 0030 w, 3000 w, 0008 w, 1020 w, 4080 w, 0000 w,
7088 w, 98A8 w, C888 w, 7000 w, 2060 w, 2020 w, 2020 w, 7000 w, 7088 w, 0830 w, 4080 w, F800 w, F810 w, 2030 w, 0888 w, 7000 w, 1030 w, 5090 w, F810 w, 1000 w, F880 w, F008 w, 0888 w, 7000 w, 3840 w, 80F0 w, 8888 w, 7000 w, F808 w, 1020 w, 4040 w, 4000 , 7088 w, 8870 w, 8888 w, 7000 w, 7088 w, 8878 w, 0810 w, E000 w, 0060 w, 6000 w, 6060 w, 0000 w, 0060 w, 6000 w, 6060 w, 4000 w, 1020 w, 4080 w, 4020 w, 1000 w, 0000 w, F800 w, F800 w, 0000 w, 4020 w, 1008 w, 1020 w, 4000 w, 7088 w, 1020 w, 2000 w, 2000 w,
7088 w, A8B8 w, B080 w, 7800 w, 2050 w, 8888 w, F888 w, 8800 w, F088 w, 88F0 w, 8888 w, F000 w, 7088 w, 8080 w, 8088 w, 7000 w, F048 w, 4848 w, 4848 w, F000 w, F880 w, 80F0 w, 8080 w, F800 w, F880 w, 80F0 w, 8080 w, 8000 w, 7880 w, 8080 w, 9888 w, 7800 w, 8888 w, 88F8 w, 8888 w, 8800 w, 7020 w, 2020 w, 2020 w, 7000 w, 0808 w, 0808 w, 0888 w, 7800 w, 8890 w, A0C0 w, A090 w, 8800 w, 8080 w, 8080 w, 8080 w, F800 w, 88D8 w, A8A8 w, 8888 w, 8800 w, 8888 w, C8A8 w, 9888 w, 8800 w, 7088 w, 8888 w, 8888 w, 7000 w,
F088 w, 88F0 w, 8080 w, 8000 w, 7088 w, 8888 w, A890 w, 6800 w, F088 w, 88F0 w, A090 w, 8800 w, 7088 w, 8070 w, 0888 w, 7000 w, F820 w, 2020 w, 2020 w, 2000 w, 8888 w, 8888 w, 8888 w, 7000 w, 8888 w, 8888 w, 8850 w, 2000 w, 8888 w, 88A8 w, A8D8 w, 8800 w, 8888 w, 5020 w, 5088 w, 8800 w, 8888 w, 5020 w, 2020 w, 2000 w, F808 w, 1020 w, 4080 w, F800 w, 7840 w, 4040 w, 4040 w, 7800 w, 0080 w, 4020 w, 1008 w, 0000 w, F010 w, 1010 w, 1010 w, F000 w, 0000 w, 2050 w, 8800 w, 0000 w, 0000 w, 0000 w, 0000 w, 00F8 w,
- >col ( char -- ndx ) \ convert ascii char into column index in the matrix
toupper BL - 0 MAX ; \ Space char (BL) = 0. Index is clipped to 0 as minimum value
- ]banner-matrix ( row ascii -- addr ) \ convert Banner-matrix memory to a 2 dimensional matrix
>col 8 * Banner-matrix + + ;
- PLACE ( str len addr -- ) \ store a string with length at addr
2DUP 2>R 1+ SWAP MOVE 2R> C! ;
synonym len c@ \ fetch the 1st char of a counted string to return the length
- BIT? ( byte bit# -- -1 | 0) \ given a byte and bit# on stack, return true or false flag
1 swap lshift AND ;
DECIMAL
variable bannerstr 5 allot \ memory for the character string
\ Font selection characters stored as counted strings
- STARFONT S" *" bannerstr PLACE ;
- HASHFONT S" ##" bannerstr PLACE ;
- 3DFONT S" _/" bannerstr PLACE ;
- .BIGCHAR ( matrix-byte -- )
2 7 \ we use bits 7 to 2 DO dup I bit? \ check bit I in the matrix-byte on stack IF bannerstr count TYPE \ if BIT=TRUE ELSE bannerstr len SPACES \ if BIT=false THEN -1 +LOOP \ loop backwards DROP ; \ drop the matrix-byte
- BANNER ( str len -- )
8 0 DO CR \ str len 2dup BOUNDS \ calc. begin & end addresses of string DO J I C@ ]Banner-Matrix C@ .BIGCHAR LOOP \ str len LOOP 2DROP ; \ drop str & len
\ test the solution in the Forth console
</LANG>
- Output:
3DFONT s" FORTH" banner _/_/_/_/_/ _/_/_/ _/_/_/_/ _/_/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/_/_/_/ _/ _/_/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/ _/ ok hashfont ok s" FORTH" BANNER ##### ### #### ##### # # # # # # # # # # # # # # # # # # #### # # #### # ##### # # # # # # # # # # # # # # # # # ### # # # # # ok
Go
Go does have a "Go" logo, although it is rarely used. A graphic is at http://golang.org/doc/gopher/bumper.png and the logo is the word Go with the two little lines to suggest movement. It's not 3D, so for inspiration I googled 3D ASCII fonts or something similar and found Patrick Gillespie's site at patorjk.com/software/taag/ with lots of ASCII fonts. The first one I liked was "Block" for its simple 3D illusion of drawing only the shadow, then I found "Lean." It's the same 3D effect as Block only slanted, reminiscent of the slanted Go logo.
For the interest component of the task, I thought about rendering the result from an input string and realized that it wasn't completely trivial as the glyphs of the Lean font overlap with the standard letter spacing. Rendering different fonts would add interest because now there would be a point in developing a common font representation and rendering function. Block and Lean would have sufficed, but I looked further and found the Keyboard and Small Keyboard fonts. These I found somewhat amusing, for the final component of the task. <lang go>package main
import (
"fmt" "strings"
)
var lean = font{
height: 5, slant: 1, spacing: 2, m: map[rune][]string{ 'G': []string{ ` _/_/_/`, `_/ `, `_/ _/_/`, `_/ _/`, ` _/_/_/`, }, 'o': []string{ ` `, ` _/_/ `, `_/ _/`, `_/ _/`, ` _/_/ `, }, }}
var smallKeyboard = font{
height: 4, slant: 0, spacing: -1, m: map[rune][]string{ 'G': []string{ ` ____ `, `||G ||`, `||__||`, `|/__\|`, }, 'o': []string{ ` ____ `, `||o ||`, `||__||`, `|/__\|`, }, }}
type font struct {
height int slant int spacing int m map[rune][]string
}
func render(s string, f font) string {
rows := make([]string, f.height) if f.slant != 0 { start := 0 if f.slant > 0 { start = f.height } for i := range rows { rows[i] = strings.Repeat(" ", (start-i)*f.slant) } } if f.spacing >= 0 { spacing := strings.Repeat(" ", f.spacing) for j, c := range s { for i, r := range f.m[c] { if j > 0 { r = spacing + r } rows[i] += r } } } else { overlap := -f.spacing for j, c := range s { for i, r := range f.m[c] { if j > 0 { r = r[overlap:] } rows[i] += r } } } return strings.Join(rows, "\n")
}
func main() {
fmt.Println(render("Go", lean)) fmt.Println(render("Go", smallKeyboard))
}</lang>
- Output:
_/_/_/ _/ _/_/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/ ____ ____ ||G |||o || ||__|||__|| |/__\|/__\|
Groovy
A simple way to display ASCII art <lang Groovy>println """\
_|_|_|
_| _| _|_| _|_| _|_| _| _| _| _| _| _|_| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|
_|_|_| _| _|_| _|_| _| _|_|_| _| _|_|"""</lang>
A more complicated example: <lang Groovy>String.metaClass.getAsAsciiArt = {
def request = "http://www.network-science.de/ascii/ascii.php?TEXT=${delegate}&x=23&y=10&FONT=block&RICH=no&FORM=left&STRE=no&WIDT=80" def html = new URL(request).text
(html =~ '
([^<]+)
')[-1][1]
}
println "Groovy".asAsciiArt</lang>
- Output:
_|_|_| _| _| _|_| _|_| _|_| _| _| _| _| _| _|_| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_|_| _| _|_| _|_| _| _|_|_| _| _|_|
Haskell
A simple printing of the ASCII art <lang Haskell>module Main where {-
__ __ __ ___ ___
/\ \/\ \ /\ \ /\_ \ /\_ \ \ \ \_\ \ __ ____\ \ \/'\ __\//\ \ \//\ \
\ \ _ \ /'__`\ /',__\\ \ , < /'__`\\ \ \ \ \ \ \ \ \ \ \/\ \L\.\_/\__, `\\ \ \\`\ /\ __/ \_\ \_ \_\ \_ \ \_\ \_\ \__/.\_\/\____/ \ \_\ \_\ \____\/\____\/\____\ \/_/\/_/\/__/\/_/\/___/ \/_/\/_/\/____/\/____/\/____/
-}
ascii3d :: String ascii3d = " __ __ __ ___ ___ \n" ++
"/\\ \\/\\ \\ /\\ \\ /\\_ \\ /\\_ \\ \n" ++ "\\ \\ \\_\\ \\ __ ____\\ \\ \\/'\\ __\\//\\ \\ \\//\\ \\ \n" ++ " \\ \\ _ \\ /'__`\\ /',__\\\\ \\ , < /'__`\\\\ \\ \\ \\ \\ \\ \n" ++ " \\ \\ \\ \\ \\/\\ \\L\\.\\_/\\__, `\\\\ \\ \\\\`\\ /\\ __/ \\_\\ \\_ \\_\\ \\_ \n" ++ " \\ \\_\\ \\_\\ \\__/.\\_\\/\\____/ \\ \\_\\ \\_\\ \\____\\/\\____\\/\\____\\\n" ++ " \\/_/\\/_/\\/__/\\/_/\\/___/ \\/_/\\/_/\\/____/\\/____/\\/____/"
main = putStrLn ascii3d </lang>
- Output:
__ __ __ ___ ___ /\ \/\ \ /\ \ /\_ \ /\_ \ \ \ \_\ \ __ ____\ \ \/'\ __\//\ \ \//\ \ \ \ _ \ /'__`\ /',__\\ \ , < /'__`\\ \ \ \ \ \ \ \ \ \ \/\ \L\.\_/\__, `\\ \ \\`\ /\ __/ \_\ \_ \_\ \_ \ \_\ \_\ \__/.\_\/\____/ \ \_\ \_\ \____\/\____\/\____\ \/_/\/_/\/__/\/_/\/___/ \/_/\/_/\/____/\/____/\/____/
Icon and Unicon
The following fits under the fuzzy definition of 3D ASCII and pays homage to one of the Icon Newsletter logos. <lang Icon>procedure main(arglist) write(ExpandText(
if !arglist == "icon" then "14/\\\n14\\/\n12/\\\n11/1/\n10/1/1/\\\n10\\/1/2\\\n12/1/\\1\\\n_ 12\\1\\1\\/\n10/\\1\\1\\2/\\\n9/2\\1\\/1/2\\\n_ 8/1/\\1\\2/1/\\1\\2/\\\n8\\1\\/1/2\\1\\/1/2\\1\\\n_ 6/\\1\\2/4\\2/1/\\1\\1\\\n5/1/2\\/6\\/1/2\\1\\/\n_ /\\2/1/1/\\10/1/\\1\\2/\\\n\\/2\\1\\/1/10\\/1/1/2\\/\n_ 2/\\1\\2/1/\\6/\\2/1/\n2\\1\\1\\/1/2\\4/2\\1\\/\n_ 3\\1\\2/1/\\1\\2/1/\\1\\\n4\\/2\\1\\/1/2\\1\\/1/\n_ 9\\2/1/\\1\\2/\n10\\/2\\1\\1\\/\n12/\\1\\1\\\n12\\1\\/1/\n_ 13\\2/1/\\\n14\\/1/1/\n16/1/\n16\\/\n14/\\\n14\\/\n" else "13/\\\n12/1/\n11/1/1/\\\n11\\1\\/1/\n12\\2/1/\\\n13\\/1/2\\\n_ 15/1/\\1\\2/\\\n15\\/1/1/2\\/\n17/1/1/\\18/\\\n17\\/1/1/17/2\\\n_ 19/1/1/\\14/1/\\1\\\n19\\/1/2\\13\\1\\1\\/\n21/1/\\1\\10/\\1\\1\\\n_ 21\\1\\1\\/10\\1\\1\\/\n19/\\1\\1\\2/\\6/\\1\\1\\\n_ 18/2\\1\\/1/2\\5\\1\\/1/\n17/1/\\1\\2/1/\\1\\2/\\1\\2/\n_ 17\\1\\/1/2\\1\\/1/2\\1\\1\\/\n15/\\1\\2/4\\2/1/\\1\\1\\\n_ 14/1/2\\/6\\/1/2\\1\\/\n9/\\2/1/1/\\10/1/\\1\\2/\\\n_ 9\\/2\\1\\/1/10\\/1/1/2\\/\n11/\\1\\2/1/\\6/\\2/1/\n_ 11\\1\\1\\/1/2\\4/2\\1\\/\n9/\\1\\1\\2/1/\\1\\2/1/\\1\\\n_ 8/2\\1\\/2\\1\\/1/2\\1\\/1/\n7/1/\\1\\5\\2/1/\\1\\2/\n_ 7\\1\\1\\/6\\/2\\1\\1\\/\n5/\\1\\1\\10/\\1\\1\\\n_ 5\\1\\1\\/10\\1\\/1/\n3/\\1\\1\\13\\2/1/\\\n3\\1\\/1/14\\/1/1/\n_ 4\\2/17/1/1/\\\n5\\/18\\/1/1/\n23/\\2/1/1/\\\n23\\/2\\1\\/1/\n_ 28\\2/1/\\\n29\\/1/2\\\n31/1/\\1\\\n31\\/1/1/\n33/1/\n33\\/\n" ))
end
procedure ExpandText(s) s ? until pos(0) do
writes(repl(" ",tab(many(&digits)))|tab(upto(&digits)|0))
end</lang>
- Output:
with "icon" as the argument
/\ \/ /\ / / / / /\ \/ / \ / /\ \ \ \ \/ /\ \ \ /\ / \ \/ / \ / /\ \ / /\ \ /\ \ \/ / \ \/ / \ \ /\ \ / \ / /\ \ \ / / \/ \/ / \ \/ /\ / / /\ / /\ \ /\ \/ \ \/ / \/ / / \/ /\ \ / /\ /\ / / \ \ \/ / \ / \ \/ \ \ / /\ \ / /\ \ \/ \ \/ / \ \/ / \ / /\ \ / \/ \ \ \/ /\ \ \ \ \/ / \ / /\ \/ / / / / \/ /\ \/
J
<lang j> require 'vrml.ijs' NB. Due to Andrew Nikitin
view 5#.^:_1]21-~a.i.'j*ez`C3\toy.G)' NB. Due to Oleg Kobchenko ________________________ |\ \ \ \ \ | \_____\_____\_____\_____\ | | | | |\ \ |\| | | | \_____\ | \_____|_____|_____| | | | | | | | |\| | \| | |\| | \_____| \_____| | \_____| | | | |\| | | \_____| ______ | | |
|\ \ |\| | | \_____\_________|_\_____| | |\ \ \ \ |
\| \_____\_____\_____\ | | | | | |___| \| | | | \_____|_____|_____|
</lang>
For the VRML script, see Andrew Nikitin's J page (search for VRML) and for the origin of the 3D J banner, see Oleg Kobchenko's post to the J Forums.
Here's a slimmer version:
<lang J> view 8 8 8#:'"#$%&,4<DHLPTYZ[\'-&(a.&i.)' '
______ |\ \ | \_____\ | |\ \ \| \_____\ | |\ \ \| \_____\ | |\ \ |\| \_____\ | | |\ \ | |\| \_____\ ______ |\| | | |
|\ \| \__\| | | \_____| | \_____| | | |\| | |\| | \_____| | \_____| | | | | |\| |
\| | \_____| \_____| | | |\ |\| | | \___| \_____| | |\ | | | \| \_|\| | | |\| \_____| \| | | | | |\| | \| \_____| | | | \| | \_____|
</lang>
Explanation: the argument says where to place the solid "blocks". Each block is described by three integers, describing position along the x, y and z axis. In other words, 1 0 0 is one position to the right of 0 0 0, while 0 1 0 is one place down and 0 0 1 is one place towards the observer. (Thus the space at the top of the "slimmer" version could have been eliminated by subtracting 2 from the middle column of integers being passed to 'view'.)
It's convenient to encode these three element values as ascii characters. The original used base 5 (after subtracting 21), the alternate version used octal (after subtracting 32).
Note that the order the block positions are described in is irrelevant (the characters indicating position could be shuffled with no change in the rendered result).
Java
This was written ages ago as an exercise in obfuscation, and improved here with upper case letters. The font is "lean" from figlet.
It's not really that obfuscated. The characters in z are used to draw the letters. The array f contains one element per letter of the alphabet. Each array element is another array of 7 longs because each output letter is made of 7 lines of text. Each long value represents a sequence of 2-bit integers that are extracted by bit-twiddling and used to find the right character in z. <lang java>public class F5{
char[]z={' ',' ','_','/',}; long[][]f={ {87381,87381,87381,87381,87381,87381,87381,}, {349525,375733,742837,742837,375733,349525,349525,}, {742741,768853,742837,742837,768853,349525,349525,}, {349525,375733,742741,742741,375733,349525,349525,}, {349621,375733,742837,742837,375733,349525,349525,}, {349525,375637,768949,742741,375733,349525,349525,}, {351157,374101,768949,374101,374101,349525,349525,}, {349525,375733,742837,742837,375733,349621,351157,}, {742741,768853,742837,742837,742837,349525,349525,}, {181,85,181,181,181,85,85,}, {1461,1365,1461,1461,1461,1461,2901,}, {742741,744277,767317,744277,742837,349525,349525,}, {181,181,181,181,181,85,85,}, {1431655765,3149249365L,3042661813L,3042661813L,3042661813L,1431655765,1431655765,}, {349525,768853,742837,742837,742837,349525,349525,}, {349525,375637,742837,742837,375637,349525,349525,}, {349525,768853,742837,742837,768853,742741,742741,}, {349525,375733,742837,742837,375733,349621,349621,}, {349525,744373,767317,742741,742741,349525,349525,}, {349525,375733,767317,351157,768853,349525,349525,}, {374101,768949,374101,374101,351157,349525,349525,}, {349525,742837,742837,742837,375733,349525,349525,}, {5592405,11883957,11883957,5987157,5616981,5592405,5592405,}, {366503875925L,778827027893L,778827027893L,392374737749L,368114513237L,366503875925L,366503875925L,}, {349525,742837,375637,742837,742837,349525,349525,}, {349525,742837,742837,742837,375733,349621,375637,}, {349525,768949,351061,374101,768949,349525,349525,}, {375637,742837,768949,742837,742837,349525,349525,}, {768853,742837,768853,742837,768853,349525,349525,}, {375733,742741,742741,742741,375733,349525,349525,}, {192213,185709,185709,185709,192213,87381,87381,}, {1817525,1791317,1817429,1791317,1817525,1398101,1398101,}, {768949,742741,768853,742741,742741,349525,349525,}, {375733,742741,744373,742837,375733,349525,349525,}, {742837,742837,768949,742837,742837,349525,349525,}, {48053,23381,23381,23381,48053,21845,21845,}, {349621,349621,349621,742837,375637,349525,349525,}, {742837,744277,767317,744277,742837,349525,349525,}, {742741,742741,742741,742741,768949,349525,349525,}, {11883957,12278709,11908533,11883957,11883957,5592405,5592405,}, {11883957,12277173,11908533,11885493,11883957,5592405,5592405,}, {375637,742837,742837,742837,375637,349525,349525,}, {768853,742837,768853,742741,742741,349525,349525,}, {6010197,11885397,11909973,11885397,6010293,5592405,5592405,}, {768853,742837,768853,742837,742837,349525,349525,}, {375733,742741,375637,349621,768853,349525,349525,}, {12303285,5616981,5616981,5616981,5616981,5592405,5592405,}, {742837,742837,742837,742837,375637,349525,349525,}, {11883957,11883957,11883957,5987157,5616981,5592405,5592405,}, {3042268597L,3042268597L,3042661813L,1532713813,1437971797,1431655765,1431655765,}, {11883957,5987157,5616981,5987157,11883957,5592405,5592405,}, {11883957,5987157,5616981,5616981,5616981,5592405,5592405,}, {12303285,5593941,5616981,5985621,12303285,5592405,5592405,},}; public static void main(String[]a){ new F5(a.length>0?a[0]:"Java");} private F5(String s){ StringBuilder[]o=new StringBuilder[7]; for(int i=0;i<7;i++)o[i]=new StringBuilder(); for(int i=0,l=s.length();i<l;i++){ int c=s.charAt(i); if(65<=c&&c<=90)c-=39; else if(97<=c&&c<=122)c-=97; else c=-1; long[]d=f[++c]; for(int j=0;j<7;j++){ StringBuilder b=new StringBuilder(); long v=d[j]; while(v>0){ b.append(z[(int)(v&3)]); v>>=2;} o[j].append(b.reverse().toString());}} for(int i=0;i<7;i++){ for(int j=0;j<7-i;j++) System.out.print(' '); System.out.println(o[i]);}}}
</lang>
- Output:
With no parameters
_/ _/ _/_/_/ _/ _/ _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/_/ _/ _/_/_/
Pass "Something Else" and the output is:
- Output:
_/_/_/ _/ _/ _/ _/_/_/_/ _/ _/ _/_/ _/_/_/ _/_/ _/_/ _/_/_/_/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/_/ _/_/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/_/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/_/_/ _/_/ _/ _/ _/ _/_/_/ _/_/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/_/ _/ _/_/_/ _/_/_/ _/ _/_/
Julia
<lang julia>println(replace(raw"""
xxxxx x x x x x x x x x x x x x x xxx x x x x x x x x x x x x x x xx xx xx x x x x xx """, "x" => "_/"))
</lang>
- Output:
_/_/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/ _/_/ _/ _/ _/ _/ _/_/
Kotlin
<lang scala>// version 1.1
class Ascii3D(s: String) {
val z = charArrayOf(' ', ' ', '_', '/')
val f = arrayOf( longArrayOf(87381, 87381, 87381, 87381, 87381, 87381, 87381), longArrayOf(349525, 375733, 742837, 742837, 375733, 349525, 349525), longArrayOf(742741, 768853, 742837, 742837, 768853, 349525, 349525), longArrayOf(349525, 375733, 742741, 742741, 375733, 349525, 349525), longArrayOf(349621, 375733, 742837, 742837, 375733, 349525, 349525), longArrayOf(349525, 375637, 768949, 742741, 375733, 349525, 349525), longArrayOf(351157, 374101, 768949, 374101, 374101, 349525, 349525), longArrayOf(349525, 375733, 742837, 742837, 375733, 349621, 351157), longArrayOf(742741, 768853, 742837, 742837, 742837, 349525, 349525), longArrayOf(181, 85, 181, 181, 181, 85, 85), longArrayOf(1461, 1365, 1461, 1461, 1461, 1461, 2901), longArrayOf(742741, 744277, 767317, 744277, 742837, 349525, 349525), longArrayOf(181, 181, 181, 181, 181, 85, 85), longArrayOf(1431655765, 3149249365L, 3042661813L, 3042661813L, 3042661813L, 1431655765, 1431655765), longArrayOf(349525, 768853, 742837, 742837, 742837, 349525, 349525), longArrayOf(349525, 375637, 742837, 742837, 375637, 349525, 349525), longArrayOf(349525, 768853, 742837, 742837, 768853, 742741, 742741), longArrayOf(349525, 375733, 742837, 742837, 375733, 349621, 349621), longArrayOf(349525, 744373, 767317, 742741, 742741, 349525, 349525), longArrayOf(349525, 375733, 767317, 351157, 768853, 349525, 349525), longArrayOf(374101, 768949, 374101, 374101, 351157, 349525, 349525), longArrayOf(349525, 742837, 742837, 742837, 375733, 349525, 349525), longArrayOf(5592405, 11883957, 11883957, 5987157, 5616981, 5592405, 5592405), longArrayOf(366503875925L, 778827027893L, 778827027893L, 392374737749L, 368114513237L, 366503875925L, 366503875925L), longArrayOf(349525, 742837, 375637, 742837, 742837, 349525, 349525), longArrayOf(349525, 742837, 742837, 742837, 375733, 349621, 375637), longArrayOf(349525, 768949, 351061, 374101, 768949, 349525, 349525), longArrayOf(375637, 742837, 768949, 742837, 742837, 349525, 349525), longArrayOf(768853, 742837, 768853, 742837, 768853, 349525, 349525), longArrayOf(375733, 742741, 742741, 742741, 375733, 349525, 349525), longArrayOf(192213, 185709, 185709, 185709, 192213, 87381, 87381), longArrayOf(1817525, 1791317, 1817429, 1791317, 1817525, 1398101, 1398101), longArrayOf(768949, 742741, 768853, 742741, 742741, 349525, 349525), longArrayOf(375733, 742741, 744373, 742837, 375733, 349525, 349525), longArrayOf(742837, 742837, 768949, 742837, 742837, 349525, 349525), longArrayOf(48053, 23381, 23381, 23381, 48053, 21845, 21845), longArrayOf(349621, 349621, 349621, 742837, 375637, 349525, 349525), longArrayOf(742837, 744277, 767317, 744277, 742837, 349525, 349525), longArrayOf(742741, 742741, 742741, 742741, 768949, 349525, 349525), longArrayOf(11883957, 12278709, 11908533, 11883957, 11883957, 5592405, 5592405), longArrayOf(11883957, 12277173, 11908533, 11885493, 11883957, 5592405, 5592405), longArrayOf(375637, 742837, 742837, 742837, 375637, 349525, 349525), longArrayOf(768853, 742837, 768853, 742741, 742741, 349525, 349525), longArrayOf(6010197, 11885397, 11909973, 11885397, 6010293, 5592405, 5592405), longArrayOf(768853, 742837, 768853, 742837, 742837, 349525, 349525), longArrayOf(375733, 742741, 375637, 349621, 768853, 349525, 349525), longArrayOf(12303285, 5616981, 5616981, 5616981, 5616981, 5592405, 5592405), longArrayOf(742837, 742837, 742837, 742837, 375637, 349525, 349525), longArrayOf(11883957, 11883957, 11883957, 5987157, 5616981, 5592405, 5592405), longArrayOf(3042268597L, 3042268597L, 3042661813L, 1532713813, 1437971797, 1431655765, 1431655765), longArrayOf(11883957, 5987157, 5616981, 5987157, 11883957, 5592405, 5592405), longArrayOf(11883957, 5987157, 5616981, 5616981, 5616981, 5592405, 5592405), longArrayOf(12303285, 5593941, 5616981, 5985621, 12303285, 5592405, 5592405) )
init { val o = Array(7) { StringBuilder() } for (i in 0 until s.length) { var c = s[i].toInt() if (c in 65..90) { c -= 39 } else if (c in 97..122) { c -= 97 } else { c = -1 } val d = f[++c] for (j in 0 until 7) { val b = StringBuilder() var v = d[j] while (v > 0) { b.append(z[(v and 3).toInt()]) v = v shr 2 } o[j].append(b.reverse().toString()) } } for (i in 0 until 7) { for (j in 0 until 7 - i) print(' ') println(o[i]) } }
}
fun main(args: Array<String>) {
Ascii3D("KOTLIN") Ascii3D("with thanks") Ascii3D("to the author") Ascii3D("of the") Ascii3D("Java entry")
}</lang>
- Output:
_/ _/ _/_/ _/_/_/_/_/ _/ _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/_/ _/ _/_/_/_/ _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/_/_/ _/_/_/_/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/_/ _/ _/ _/_/ _/ _/ _/_/_/ _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/ _/ _/_/_/_/ _/_/ _/_/_/_/ _/_/_/ _/_/ _/_/_/ _/ _/ _/_/_/_/ _/_/_/ _/_/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/ _/_/ _/ _/ _/_/_/ _/_/_/ _/_/_/ _/_/ _/ _/ _/_/ _/ _/_/ _/ _/ _/_/ _/ _/_/_/_/ _/_/_/ _/_/ _/ _/ _/_/_/_/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/_/ _/ _/ _/_/_/ _/ _/ _/ _/_/_/ _/ _/ _/_/_/ _/_/ _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/_/ _/ _/_/_/ _/_/_/ _/ _/ _/_/ _/ _/_/_/ _/ _/_/
Lasso
<lang Lasso>local(lasso = "
| ,--, | | ,---.'| ,----.. | | | | : ,---, .--.--. .--.--. / / \\ | | : : | ' .' \\ / / '. / / '. / . : | | | ' : / ; '. | : /`. /| : /`. / . / ;. \\ | | ; ; ' : : \\ ; | |--` ; | |--` . ; / ` ; | | ' | |__ : | /\\ \\| : ;_ | : ;_ ; | ; \\ ; | | | | | :.'|| : ' ;. :\\ \\ `. \\ \\ `. | : | ; | ' | | ' : ;| | ;/ \\ \\`----. \\ `----. \\. | ' ' ' : | | | | ./ ' : | \\ \\ ,'__ \\ \\ | __ \\ \\ |' ; \\; / | | | ; : ; | | ' '--' / /`--' // /`--' / \\ \\ ', / | | | ,/ | : : '--'. /'--'. / ; : / | | '---' | | ,' `--'---' `--'---' \\ \\ .' | | `-- `---` |
")
stdoutnl(#lasso)</lang>
--------------------------------------------------------------- | ,--, | | ,---.'| ,----.. | | | | : ,---, .--.--. .--.--. / / \ | | : : | ' .' \ / / '. / / '. / . : | | | ' : / ; '. | : /`. /| : /`. / . / ;. \ | | ; ; ' : : \ ; | |--` ; | |--` . ; / ` ; | | ' | |__ : | /\ \| : ;_ | : ;_ ; | ; \ ; | | | | | :.'|| : ' ;. :\ \ `. \ \ `. | : | ; | ' | | ' : ;| | ;/ \ \`----. \ `----. \. | ' ' ' : | | | | ./ ' : | \ \ ,'__ \ \ | __ \ \ |' ; \; / | | | ; : ; | | ' '--' / /`--' // /`--' / \ \ ', / | | | ,/ | : : '--'. /'--'. / ; : / | | '---' | | ,' `--'---' `--'---' \ \ .' | | `--'' `---` | ----------------------------------------------------------------
Lua
<lang lua>io.write(" /$$\n") io.write("| $$\n") io.write("| $$ /$$ /$$ /$$$$$$\n") io.write("| $$ | $$ | $$ |____ $$\n") io.write("| $$ | $$ | $$ /$$$$$$$\n") io.write("| $$ | $$ | $$ /$$__ $$\n") io.write("| $$$$$$$$| $$$$$$/| $$$$$$$\n") io.write("|________/ \______/ \_______/\n")</lang>
- Output:
/$$ | $$ | $$ /$$ /$$ /$$$$$$ | $$ | $$ | $$ |____ $$ | $$ | $$ | $$ /$$$$$$$ | $$ | $$ | $$ /$$__ $$ | $$$$$$$$| $$$$$$/| $$$$$$$ |________/ ______/ _______/
Mathematica
No hardcoding at all! <lang Mathematica>locs = Position[
ImageData[Binarize[Rasterize["Mathematica", ImageSize -> 150]]], 0];
Print[StringRiffle[
StringJoin /@ ReplacePart[ ReplacePart[ ConstantArray[ " ", {Max[locsAll, 1] + 1, Max[locsAll, 2] + 1}], locs -> "\\"], Map[# + 1 &, locs, {2}] -> "#"], "\n"]];</lang>
- Output:
\\\ \\ \### \## \\\\ \\\\ \ ### \ ## #### \\#### \# \## \# \## \#### \\\\\\ \\\#\\\\\ \##\\\\ \\\\\\ \\\\\\ \\\\ \\\\\\\ \\\#\\\\ \\\\ \\\\\ \ \\\\\\ \\### \\#\## \\###### ######### \##\#### \\###### ######\#### \\####### ######## #### \\#####\# \\###### \##\# \##\## ## \# \# \#### ## \\## ## \### ### ## ## \# \# \# \\## ### ## \# \##\##\# \## \## \# \## \# \## \## \## \# \# \## \# \# \## \## \## \## ##\# \## \\\\\\## \# \## \# \## ## \## \# \# \\\\\\\## \# \# \## ## \\\\\\## \## \#\# \## \\####### \# \## \# \#\\\\\\\\# \## \# \# \\######## \# \# \\# \\####### \## \### \## \\## \## \# \## \# \########## \## \# \# \\## \## \# \# ## \\## \## \# ## \## \## \## \# \## \# \# \## \# \# \## \## \# \# \# \ \## \## \# \## ## \\\## \# \\ \## \# #\ \\\ \## \# \# ## \\\## \# \\ \# ## \\\# ## \\\## \\#\\ \\\##\ #\\\####\ ##\\\\## \\## \\\#\ ##\\\\\###\\## \# \#\ #\\\\####\ ##\\\## \\\\\\#\\\ ##\\\### #\\\####\ ##### ###### #### #### ###### #### ##### ####### #### ## ### ##### #### ##### ########## ##### #### ####
Modula-2
<lang modula2>MODULE Art; FROM Terminal IMPORT WriteString,WriteLn,ReadChar;
BEGIN
(* 3D, but does not fit in the terminal window *) (* WriteString("_____ ______ ________ ________ ___ ___ ___ ________ _______"); WriteLn; WriteString("|\ _ \ _ \|\ __ \|\ ___ \|\ \|\ \|\ \ |\ __ \ / ___ \"); WriteLn; WriteString("\ \ \\\__\ \ \ \ \|\ \ \ \_|\ \ \ \\\ \ \ \ \ \ \|\ \ ____________ /__/|_/ /|"); WriteLn; WriteString(" \ \ \\|__| \ \ \ \\\ \ \ \ \\ \ \ \\\ \ \ \ \ \ __ \|\____________\__|// / /"); WriteLn; WriteString(" \ \ \ \ \ \ \ \\\ \ \ \_\\ \ \ \\\ \ \ \____\ \ \ \ \|____________| / /_/__"); WriteLn; WriteString(" \ \__\ \ \__\ \_______\ \_______\ \_______\ \_______\ \__\ \__\ |\________\"); WriteLn; WriteString(" \|__| \|__|\|_______|\|_______|\|_______|\|_______|\|__|\|__| \|_______|"); WriteLn; *)
(* Not 3D, but fits in the terminal window *) WriteString(" __ __ _ _ ___"); WriteLn; WriteString(" | \/ | | | | | |__ \"); WriteLn; WriteString(" | \ / | ___ __| |_ _| | __ _ ______ ) |"); WriteLn; WriteString(" | |\/| |/ _ \ / _` | | | | |/ _` |______/ /"); WriteLn; WriteString(" | | | | (_) | (_| | |_| | | (_| | / /_"); WriteLn; WriteString(" |_| |_|\___/ \__,_|\__,_|_|\__,_| |____|"); WriteLn;
ReadChar
END Art. </lang>
NetRexx
Based on an idea found in the Scala version. <lang NetRexx>/* NetRexx */ options replace format comments java crossref symbols nobinary
txt = ; x = 0 x = x + 1; txt[0] = x; txt[x] = ' * * *****' x = x + 1; txt[0] = x; txt[x] = ' ** * * * *' x = x + 1; txt[0] = x; txt[x] = ' * * * *** *** * * *** * * * *' x = x + 1; txt[0] = x; txt[x] = ' * * * * * * ***** * * * * * *' x = x + 1; txt[0] = x; txt[x] = ' * ** ***** * * * ***** * *' x = x + 1; txt[0] = x; txt[x] = ' * * * * * * * * * * *' x = x + 1; txt[0] = x; txt[x] = ' * * *** ** * * *** * * * *' x = x + 1; txt[0] = x; txt[x] =
_top = '_TOP' _bot = '_BOT' txt = Banner3D(txt, isTrue()) loop ll = 1 to txt[0]
say txt[ll, _top] say txt[ll, _bot] end ll
return
method Banner3D(txt, slope = ) public static
select when slope = isTrue() then nop when slope = isFalse() then nop otherwise do if slope = then slope = isFalse() else slope = isTrue() end end
_top = '_TOP' _bot = '_BOT' loop ll = 1 to txt[0] txt[ll, _top] = txt[ll] txt[ll, _bot] = txt[ll] txt[ll, _top] = txt[ll, _top].changestr(' ', ' ') txt[ll, _bot] = txt[ll, _bot].changestr(' ', ' ') txt[ll, _top] = txt[ll, _top].changestr('*', '///') txt[ll, _bot] = txt[ll, _bot].changestr('*', '\\\\\\') txt[ll, _top] = txt[ll, _top] || ' ' txt[ll, _bot] = txt[ll, _bot] || ' ' txt[ll, _top] = txt[ll, _top].changestr('/ ', '/\\') txt[ll, _bot] = txt[ll, _bot].changestr('\\ ', '\\/') end ll
if slope then do loop li = txt[0] to 1 by -1 ll = txt[0] - li + 1 txt[ll, _top] = txt[ll, _top].insert(, 1, li - 1, ' ') txt[ll, _bot] = txt[ll, _bot].insert(, 1, li - 1, ' ') end li end
return txt
method isTrue public constant binary returns boolean
return 1 == 1
method isFalse public constant binary returns boolean
return \isTrue()
</lang>
- Output:
///\ ///\ ///////////////\ \\\/ \\\/ \\\\\\\\\\\\\\\/ //////\ ///\ ///\ ///\ ///\ \\\\\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ ///\ /////////\ /////////\ ///\ ///\ /////////\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\/ \\\\\\\\\/ \\\\\\\\\/ \\\/ \\\/ \\\\\\\\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ ///\ ///\ ///\ ///\ ///////////////\ ///\ ///\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\\\\\\\\\\\\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ ///\ //////\ ///////////////\ ///\ ///\ ///\ ///////////////\ ///\ ///\ \\\/ \\\\\\/ \\\\\\\\\\\\\\\/ \\\/ \\\/ \\\/ \\\\\\\\\\\\\\\/ \\\/ \\\/ ///\ ///\ ///\ ///\ ///\ ///\ ///\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ /////////\ //////\ ///\ ///\ /////////\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\\\\\\\/ \\\\\\/ \\\/ \\\/ \\\\\\\\\/ \\\/ \\\/ \\\/ \\\/
Nim
<lang nim>import strutils
const nim = """
# # ##### # # ## # # ## ## # # # # # ## # # # # # # # # ## # # # # # ##### # #"""
let lines = nim.replace("#", "<<<").replace(" ", "X").replace("X", " ").replace("\n", " Y").replace("< ", "<>").split('Y') for i, line in lines:
echo spaces((lines.len - i) * 3), line</lang>
- Output:
<<<> <<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<> <<<> <<<> <<<<<<> <<<<<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<> <<<> <<<> <<<> <<<> <<<<<<<<<<<<<<<> <<<> <<
OCaml
<lang OCaml>
print_string " _|_|_| _|_|_| _|_| _|_| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_|_| _|_|_| _| _| _| _| _|_|_|_|_| "
</lang>
- Output:
_|_|_| _|_|_| _|_| _|_| _|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_|_| _| _| _| _| _| _| _| _| _| _| _| _| _| _|_|_| _|_|_| _| _| _| _| _|_|_|_|_|
Pascal
<lang pascal> program WritePascal;
const
i64: int64 = 1055120232691680095; (* This defines "Pascal" *) cc: array[-1..15] of string = (* Here are all string-constants *) ('_______v---', '__', '\_', '___', '\__', ' ', ' ', ' ', ' ', '/ ', ' ', '_/ ', '\/ ', ' _', '__', ' _', ' _');
var
x, y: integer;
begin
for y := 0 to 7 do begin Write(StringOfChar(cc[(not y and 1) shl 2][1], 23 - y and 6)); Write(cc[((i64 shr (y div 2)) and 1) shl 3 + (not y and 1) shl 2 + 2]); for x := 0 to 15 do Write(cc[((i64 shr ((x and 15) * 4 + y div 2)) and 1) + ((i64 shr (((x + 1) and 15) * 4 + y div 2)) and 1) shl 3 + (x mod 3) and 2 + (not y and 1) shl 2]); writeln(cc[1 + (not y and 1) shl 2] + cc[(not y and 1) shl 3 - 1]); end;
end. </lang> Need 64-Bit Integer for this solution. My goal was to do a straight-forward solution, (Just two nested loops, no conditional code). All characters in one place.
- Output:
_____ _ ________________________/ \______________________________/ \________v--- _ _ ___ ___ _ ___ _ ______________________/ \_/ \__/ \__/ \__/ \____/ \__/ \________v--- ___ _ _ _ _ _ _ _ ____________________/ \__/ \_/ \__/ \__/ \____/ \_/ \__/ \________v--- _ ___ ___ ___ ___ _ __________________/ \______/ \/ \____/ \__/ \__/ \________v---
Perl
<lang perl>#!/usr/bin/perl use strict; use warnings;
for my $tuple ([" ", 2], ["_", 1], [" ", 1], ["\\", 1], [" ", 11], ["|", 1], ["\n", 1],
[" ", 1], ["|", 1], [" ", 3], ["|", 1], [" ", 1], ["_", 1], [" ", 1], ["\\", 1], [" ", 2], ["_", 2], ["|", 1], [" ", 1], ["|", 1], ["\n", 1], [" ", 1], ["_", 3], ["/", 1], [" ", 2], ["_", 2], ["/", 1], [" ", 1], ["|", 1], [" ", 4], ["|", 1], ["\n", 1], ["_", 1], ["|", 1], [" ", 3], ["\\", 1], ["_", 3], ["|", 1], ["_", 1], ["|", 1], [" ", 3], ["_", 1], ["|", 1], ["\n", 1] ) { print $tuple->[0] x $tuple->[1];
}</lang>
- Output:
_ \ | | | _ \ __| | ___/ __/ | | _| \___|_| _|
Font taken from http://www.network-science.de/ascii/.
Perl 6
Produces a good old-fashioned stereogram, meant to be looked at by focusing beyond the screen, not by crossing your eyes. If you can't get it to converge, try shrinking the font size till the images are closer together than your eyes. Also helps to be old enough to have progressive lenses, so you can look through the reading part of your glasses. Or borrow glasses from someone who's farsighted. :-) <lang perl6># must be evenly padded with white-space$ my $text = q:to/END/;
@@@@@ @@ @ @ @ @@@ @ @ @ @@ @ @ @@@ @ @@ @ @@ @@@@@ @ @ @@ @ @ @@@@@ @ @@@@@ @ @ @@ @@ @ @ @ @ @@ @@ @ @@@ @ @@ @@@@
END
say for ^5; for $text.lines -> $_ is copy {
my @chars = |「-+ ., ;: '"」.comb.pick(*) xx *; s:g [' '] = @chars.shift; print " $_ "; s:g [('@'+)(.)] = @chars.shift ~ $0; .say;
} say for ^5;</lang>
- Output:
";,' :-+ . ,. ; -:+"',';-. : " + ";,' :-+ . ,. ; -:+"',';-. : " + :@@@@@ ,'+".-; ;-+,@@"' :. ;. " :'@@@@@ ,'+".-; ;-+,,@@' :. ;. " "@-. @ ';,+:- +: ,;@'". +@@@, "- " @. .@';,+:- +: ,;:@". +;@@@ "- '@,- ;@ "+: .+ -',:" @; . @@; -" , ':@- ;'@"+: .+ -',:" .@ . +@@ -" , ;@ +, @"-@@@' :@.@@ @-,:.@@+ ;'": ; @+, .@-'@@@ : @;@@ @,:.+@@ ;'": @@@@@+-@':.@, @@" @;@ +":@@@@@', ;@@@@@--@:. @ .@@ :@ @+": @@@@@, @;-+, .@@@@@ :@"'+' @"-,:@@; @@. +@-+, .,@@@@@::@'+' @-,: @@ "@@ :@ . "- @,;+'; @" .-'@ +:,@@ ;@@'+ :-@. "- ,@;+'; "@ .-' @+:, @@;:@@+ +@'"., ; @@@ -:@;' "@@-+.:@@@@, +:@"., ; "@@@-:;@' ".@@+.: @@@@ ;.:+"-,' +:'; -," .+:" ;-.,' . ;.:+"-,' +:'; -," .+:" ;-.,' .
Phix
<lang Phix>constant s =
"------*** * \n"& "-----* * * \n"& "----* * * * \n"& "---*** * \n"& "--* *** * * * \n"& "-* * * * * \n"& "* * * * * * \n" puts(1,substitute(substitute(s,"*","_/")," "," "))
</lang>
- Output:
------_/_/_/ _/ -----_/ _/ _/ ----_/ _/ _/ _/ ---_/_/_/ _/ --_/ _/_/_/ _/ _/ _/ -_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
obfuscated
For those of you who like this sort of thing, same output <lang Phix>constant q = {0(30)10C,0(31)176,0(32)2A4,0(33)6N3,0(34)7GP,0(35)DWF,0(36)QC4} puts(1,substitute_all(sprintf(join(repeat("%16b",7),"\n"),q),{" ","1","0"},{"-","_/"," "})&"\n")</lang>
PicoLisp
<lang PicoLisp>(de Lst
"***** * " "* * * * * " "* * **** **** * **** ****" "***** * * * * * * * * * *" "* * * * * * * * ****" "* * * * * * * * * " "* * * * * * * * * * " "* * **** **** **** * **** * " )
(de transform (Lst A B)
(make (chain (need (length Lst) " ")) (for (L (chop (car Lst)) L) (ifn (= "*" (pop 'L)) (link " " " " " ") (chain (need 3 A)) (when (sp? (car L)) (link B " " " ") (pop 'L) ) ) ) ) )
(prinl (transform Lst "/" "\\"))
(mapc
'((X Y) (mapc '((A B) (prin (if (sp? B) A B)) ) X Y ) (prinl) ) (maplist '((X) (transform X "\\" "/")) Lst) (maplist '((X) (transform X "/" "\\")) (cdr Lst)) )
(bye)</lang>
- Output:
///////////////\ ///\ ///\\\\\\\\\///\/ ///\ ///\/ ///\ ///\/ ///\/ \\\/ ////////////\ ////////////\ ///\/ \\\/ ////////////\ ////////////\ ///////////////\/ ///\ ///\\\\\\\\\\/ ///\\\\\\///\/ ///\/ ///\ ///\\\\\\///\/ ///\\\\\\///\/ ///\\\\\\\\\\\\\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ \\///\ \\\/ ////////////\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ \\///\ ///\\\\\\\\\\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\ \\///\ ///\/ ///\/ ///\/ ////////////\ ////////////\/ ////////////\ ///\/ ////////////\/ ///\/ \\\/ \\\/ \\\\\\\\\\\\/ \\\\\\\\\\\\/ \\\\\\\\\\\\/ \\\/ \\\\\\\\\\\\/ \\\/
PureBasic
<lang purebasic>If OpenConsole()
PrintN(" ////\ ////\ ////| ") PrintN(" //// \ __ //// \ __ |XX|_/ ") PrintN(" //// /| | ////\ ////\//// |//// /| | //// | ////\ ////\ ") PrintN("|XX| |X| ////\X| ////\// //// /||XX| |X| |//// /|| //// _| ////\ //// \ ") PrintN("|XX| |X||XX| |X||XX| |/ |XX| |X||XX| |/ /|XX| |X||//// / |XX| | //// /\ |") PrintN("|XX| |/ |XX| |X||XX| /|XX| |//|XX| \|XX|/// |XX| |/\ |XX| ||XX| |XX\|") PrintN("|XX| /|XX| |X||XX| / |XX| //|XX| /| |//// |XX| ||XX| ||XX| | ") PrintN("|$$| / |$$| |&||$$| | |$$| |&||$$| |&| |$$| /||\\\\/| ||$$| ||$$| |///|") PrintN("|%%| | |%%| |i||%%| | |%%| |/ |%%| |i| |%%| |i|| |%%| ||%%| ||%%| |// |") PrintN("|ii| | |ii| |/ |ii| | |ii| /|ii| |/ /|ii| \/|/ |ii| /|ii| ||ii| |/ / ") PrintN("|::| | \\\\ /|::| | |::| / |::| / |::| / //// / |::| | \\\\ / ") PrintN("|..| | \\\\/ |..|/ \\\\/ |..| / \\\\/ \\\\ / |..|/ \\\\/ ") PrintN(" \\\\| \\\\/ ") Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input() CloseConsole()
EndIf</lang> Sample output:
////\ ////\ ////| //// \ __ //// \ __ |XX|_/ //// /| | ////\ ////\//// |//// /| | //// | ////\ ////\ |XX| |X| ////\X| ////\// //// /||XX| |X| |//// /|| //// _| ////\ //// \ |XX| |X||XX| |X||XX| |/ |XX| |X||XX| |/ /|XX| |X||//// / |XX| | //// /\ | |XX| |/ |XX| |X||XX| /|XX| |//|XX| \|XX|/// |XX| |/\ |XX| ||XX| |XX\| |XX| /|XX| |X||XX| / |XX| //|XX| /| |//// |XX| ||XX| ||XX| | |$$| / |$$| |&||$$| | |$$| |&||$$| |&| |$$| /||\\\\/| ||$$| ||$$| |///| |%%| | |%%| |i||%%| | |%%| |/ |%%| |i| |%%| |i|| |%%| ||%%| ||%%| |// | |ii| | |ii| |/ |ii| | |ii| /|ii| |/ /|ii| \/|/ |ii| /|ii| ||ii| |/ / |::| | \\\\ /|::| | |::| / |::| / |::| / //// / |::| | \\\\ / |..| | \\\\/ |..|/ \\\\/ |..| / \\\\/ \\\\ / |..|/ \\\\/ \\\\| \\\\/
Python
Again based on the Scala type idea of 'fleshing out' a 2D banner version. <lang python>py = \
##### # # ##### # # #### # # # # # # # # # # # ## # # # # # ###### # # # # # ##### # # # # # # # # # # # # # # # # # ## # # # # # #### # #
lines = py.replace('#', '<<<').replace(' ','X').replace('X', ' ').replace('\n', ' Y').replace('< ', '<>').split('Y') for i, l in enumerate(lines):
print( ' ' * (len(lines) - i) + l)</lang>
- Output:
<<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<> <<<> <<<> <<<> <<<> <<<<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<> <<<> <<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<>
Another implementation:
<lang python> l = 20 h = 11
table = [
""" .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .-----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. """, """| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |""", """| | __ | || | ______ | || | ______ | || | ________ | || | _________ | || | _________ | || | ______ | || | ____ ____ | || | _____ | || | _____ | || | ___ ____ | || | _____ | || | ____ ____ | || | ____ _____ | || | ____ | || | ______ | || | ___ | || | _______ | || | _______ | || | _________ | || | _____ _____ | || | ____ ____ | || | _____ _____ | || | ____ ____ | || | ____ ____ | || | ________ | || | ______ | || | | |""", """| | / \ | || | |_ _ \ | || | .' ___ | | || | |_ ___ `. | || | |_ ___ | | || | |_ ___ | | || | .' ___ | | || | |_ || _| | || | |_ _| | || | |_ _| | || | |_ ||_ _| | || | |_ _| | || ||_ \ / _|| || ||_ \|_ _| | || | .' `. | || | |_ __ \ | || | .' '. | || | |_ __ \ | || | / ___ | | || | | _ _ | | || ||_ _||_ _|| || ||_ _| |_ _| | || ||_ _||_ _|| || | |_ _||_ _| | || | |_ _||_ _| | || | | __ _| | || | / _ __ `. | || | | |""", """| | / /\ \ | || | | |_) | | || | / .' \_| | || | | | `. \ | || | | |_ \_| | || | | |_ \_| | || | / .' \_| | || | | |__| | | || | | | | || | | | | || | | |_/ / | || | | | | || | | \/ | | || | | \ | | | || | / .--. \ | || | | |__) | | || | / .-. \ | || | | |__) | | || | | (__ \_| | || | |_/ | | \_| | || | | | | | | || | \ \ / / | || | | | /\ | | | || | \ \ / / | || | \ \ / / | || | |_/ / / | || | |_/____) | | || | | |""", """| | / ____ \ | || | | __'. | || | | | | || | | | | | | || | | _| _ | || | | _| | || | | | ____ | || | | __ | | || | | | | || | _ | | | || | | __'. | || | | | _ | || | | |\ /| | | || | | |\ \| | | || | | | | | | || | | ___/ | || | | | | | | || | | __ / | || | '.___`-. | || | | | | || | | ' ' | | || | \ \ / / | || | | |/ \| | | || | > `' < | || | \ \/ / | || | .'.' _ | || | / ___.' | || | | |""", """| | _/ / \ \_ | || | _| |__) | | || | \ `.___.'\ | || | _| |___.' / | || | _| |___/ | | || | _| |_ | || | \ `.___] _| | || | _| | | |_ | || | _| |_ | || | | |_' | | || | _| | \ \_ | || | _| |__/ | | || | _| |_\/_| |_ | || | _| |_\ |_ | || | \ `--' / | || | _| |_ | || | \ `-' \_ | || | _| | \ \_ | || | |`\____) | | || | _| |_ | || | \ `--' / | || | \ ' / | || | | /\ | | || | _/ /'`\ \_ | || | _| |_ | || | _/ /__/ | | || | |_| | || | | |""", """| ||____| |____|| || | |_______/ | || | `._____.' | || | |________.' | || | |_________| | || | |_____| | || | `._____.' | || | |____||____| | || | |_____| | || | `.___.' | || | |____||____| | || | |________| | || ||_____||_____|| || ||_____|\____| | || | `.____.' | || | |_____| | || | `.___.\__| | || | |____| |___| | || | |_______.' | || | |_____| | || | `.__.' | || | \_/ | || | |__/ \__| | || | |____||____| | || | |______| | || | |________| | || | (_) | || | | |""", """| | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | || | | |""", """| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' |""", """ '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' """ ]
if __name__ == '__main__':
t = raw_input("Enter the text to convert :\n") if not t : t = "PYTHON" for i in range(h): txt = "" for char in t: # get dec value of T if char.isalpha(): val = ord(char.upper()) - 65 elif char == " ": val= 27 else: val = 26 begin = val*l end = val*l + l txt += table[i][begin:end] print txt
</lang>
- Output:
.----------------. .----------------. .----------------. .----------------. .----------------. .-----------------. | .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | | | ______ | || | ____ ____ | || | _________ | || | ____ ____ | || | ____ | || | ____ _____ | | | | |_ __ \ | || | |_ _||_ _| | || | | _ _ | | || | |_ || _| | || | .' `. | || ||_ \|_ _| | | | | | |__) | | || | \ \ / / | || | |_/ | | \_| | || | | |__| | | || | / .--. \ | || | | \ | | | | | | | ___/ | || | \ \/ / | || | | | | || | | __ | | || | | | | | | || | | |\ \| | | | | | _| |_ | || | _| |_ | || | _| |_ | || | _| | | |_ | || | \ `--' / | || | _| |_\ |_ | | | | |_____| | || | |______| | || | |_____| | || | |____||____| | || | `.____.' | || ||_____|\____| | | | | | || | | || | | || | | || | | || | | | | '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' | '----------------' '----------------' '----------------' '----------------' '----------------' '----------------'
A more general solution that scrapes http://www.network-science.de/ascii for the ascii art. <lang python>import requests import html
text = "Python" font = "larry3d" url = f"http://www.network-science.de/ascii/ascii.php?TEXT={text}&FONT={font}&RICH=no&FORM=left&WIDT=1000"
r = requests.get(url) r.raise_for_status()
ascii_text = html.unescape(r.text)
pre_ascii = "
" post_ascii = "\n
"
ascii_text = ascii_text[ascii_text.index(pre_ascii) + len(pre_ascii):] ascii_text = ascii_text[:ascii_text.index(post_ascii)]
print(ascii_text)</lang>
- Output:
____ __ __ /\ _`\ /\ \__ /\ \ \ \ \L\ \ __ __\ \ ,_\\ \ \___ ___ ___ \ \ ,__//\ \/\ \\ \ \/ \ \ _ `\ / __`\ /' _ `\ \ \ \/ \ \ \_\ \\ \ \_ \ \ \ \ \ /\ \L\ \/\ \/\ \ \ \_\ \/`____ \\ \__\ \ \_\ \_\\ \____/\ \_\ \_\ \/_/ `/___/> \\/__/ \/_/\/_/ \/___/ \/_/\/_/ /\___/ \/__/
Racket
Use the GUI to create a text banner:
<lang racket>
- lang racket/gui
- Get the language name
(define str (cadr (regexp-match #rx"Welcome to (.*?) *v[0-9.]+\n*$" (banner))))
- Font to use
(define font (make-object font% 12 "MiscFixed" 'decorative 'normal 'bold))
- (get-face-list) -> get a list of faces to try in the above
- Calculate the needed size (leave space for a drop-down shadow)
(define-values [W H]
(let ([bdc (make-object bitmap-dc% (make-object bitmap% 1 1 #t))]) (call-with-values (λ() (send* bdc (set-font font) (get-text-extent str font))) (λ(w h _1 _2) (values (+ 2 (inexact->exact (round w))) (+ 2 (inexact->exact (round h))))))))
- Draw the text
(define bmp (make-bitmap W H #t)) (define dc (send bmp make-dc)) (send* dc (set-font font) (draw-text str 2 0))
- Grab the pixels as a string, 3d-ed with "/"s
(define scr
(let* ([size (* W H 4)] [buf (make-bytes size)]) (send bmp get-argb-pixels 0 0 W H buf) (define scr (make-string (* (add1 W) (add1 H)) #\space)) (for ([i (in-range 0 size 4)] [j (* W H)] #:unless (zero? (bytes-ref buf i))) (string-set! scr j #\@) (for ([k (list j (+ j W -1))] [c "/."] #:when #t [k (list (- k 1) (+ k W) (+ k W -1))] #:when (and (< -1 k (string-length scr)) (member (string-ref scr k) '(#\space #\.)))) (string-set! scr k c))) scr))
- Show it, dropping empty lines
(let ([lines (for/list ([y H]) (substring scr (* y W) (* (add1 y) W)))])
(define (empty? l) (not (regexp-match #rx"[^ ]" l))) (for ([line (dropf-right (dropf lines empty?) empty?)]) (displayln (string-trim line #:left? #f))))
</lang>
- Output:
/@@@@@@@ /@@ ./@@////@@ ./@@ /@@ ./@@.../@@ ./@@ ./@@ ./@@ ./@@ /@@@@@ /@@@@@ ./@@ /@@ /@@@@ /@@@@@@ ./@@@@@@@/ /@@///@@ /@@///@@./@@/@@/ /@@//@@.///@@// ./@@@@@// .///../@@/@@/..///./@@@@/ /@@/.//@@../@@. ./@@//@@ ./@@@@@@@/@@ ... ./@@@@ ./@@@@@@@@ ./@@ ./@@.//@@ /@@////@@/@@ ./@@/@@ ./@@////// ./@@ ./@@..//@@/@@../@@@//@@ /@@./@@//@@.//@@../@@ ./@@ /@@ ./@@ ../@@//@@@@/@@.//@@@@@/./@@.//@@.//@@@@@/ .//@@@@/ ./// .///.////////..////// .///..///..////// ..///// ... ... ........ ...... ... ... ...... .....
Raven
<lang Raven>[ " ##### #### # # #### # #" " # # # # # # # ## #" " # # # # # # ### # # #" " ##### ###### # # ### # # #" " # # # # # # # # ##" " # # # # # #### # #" ] as $str
"/" as $r1 ">" as $r2
- $str each "%s\n" print
$str each as $line
$line r/#/@@@/g r/ /X/g r/X/ /g r/@ /@!/g r/@$/@!/g as $l1 $l1 "@" split $r1 join "!" split $r2 join print "\n" print
</lang>
- Output:
///////////////> ////////////> ///> ///> ////////////> ///> ///> ///> ///> ///> ///> ///> ///> ///> //////> ///> ///> ///> ///> ///> ///> ///> /////////> ///> ///> ///> ///////////////> //////////////////> ///> ///> /////////> ///> ///> ///> ///> ///> ///> ///> ///> ///> ///> ///> //////> ///> ///> ///> ///> ///> ////////////> ///> ///>
REXX
block characters
The REXX program works in ASCII or EBCDIC.
It's astonishing how much time I wasted spent on this program.
Most of the time was spent on writing comments, but the code was so easy to read, so the comments were elided. ☺
<lang rexx>/*REXX program that displays a "REXX" 3D "ASCII art" as a logo. */
signal . /* Uses left-hand shadows, slightly raised view.
0=5~2?A?2?A?
@)E)3@)B)1)2)8()2)1)2)8()2)
@]~")2@]0`)0@)%)6{)%)0@)%)6{)%)
- E)1#A@0}2)4;2(1}2)4;2(
- 3??3@0#2??@1}2)2;2(3}2)2;2(
- 2@5@)@2@0#2@A}2)0;2(5}2)0;2(
- 2@?"@)@2@0#2@?7}2){2(7}2){2(
- 2@6)@2@0#2@3)7}2)(2(9}2)(2(
- 2@??@2@0#2@?_)7}5(B}5(
- F@0#8@8}3(D}3(
- 3%3?(1#3?_@7;3)C;3)
- 2@0}2)5#2@C;5)A;5)
- 2@1}2)4#2@B;2()2)8;2()2)
- 2@2}2)3#2@?"4;2(}2)6;2(}2)
- 2@3}2)2#2@5)2;2(1}2)4;2(1}2)
- 2@4}2)1#2@?%)0;2(3}2)2;2(3}2)
0]@2@5}2)1]@A@0)[2(5}2)1)[2(5}2) 1)@%@6}%)1)@`@1V%(7}%)1V%(7}%)
- /;.:a=sigL+1;signal ..;..:u='_';do j=a to sigl-1
_=sourceline(j);_=_('(',"/");_=_('[',"//");_=_('{',"///") _=_(';',"////");_=_(')',"\");_=_(']',"\\");_=_('}',"\\\");_=_('"',"__") _=_('%',"___");_=_('?',left(,4,u));_=_('`',left(,11,u));_=_('~',left(, ,13,u));_=_('=',left(,16,u));_=_('#','|\\|');_=translate(_,"|"u,'@"') do k=0 for 16;x=d2x(k,1);_=_(x,left(,k+1));end;say ' '_;end;exit;_:return, changestr(arg(1),_,arg(2))</lang> Some older REXXes don't have a changestr BIF, so one is included here ──► CHANGESTR.REX. output
________________ _____________ ____ ____ ____ ____ |\ \ |\ \ \ \ /\ \ \ \ /\ \ |\\_______________\ |\\ ___________\ |\___\ ///\___\ |\___\ ///\___\ |\\| \ |\\| | \\\ \ //// / \\\ \ //// / |\\| ________ | |\\| ________| \\\ \ //// / \\\ \ //// / |\\| | |\| | |\\| | \\\ \ //// / \\\ \ //// / |\\| |______|\| | |\\| |____ \\\ \/// / \\\ \/// / |\\| | \| | |\\| | \ \\\ \/ / \\\ \/ / |\\| |________| | |\\| |_____\ \\\ / \\\ / |\\| | |\\| | \\\ / \\\ / |\\| ___ ____/ |\\| _____| //// \ //// \ |\\| | \\\ \ |\\| | //// \ //// \ |\\| | \\\ \ |\\| | //// /\ \ //// /\ \ |\\| | \\\ \ |\\| |______ //// /\\\ \ //// /\\\ \ |\\| | \\\ \ |\\| | \ //// / \\\ \ //// / \\\ \ |\\| | \\\ \ |\\| |_______\ //// / \\\ \ //// / \\\ \ \\| | \\\ \ \\| | \// / \\\ \ \// / \\\ \ \|___| \\\___\ \|___________| V___/ \\\___\ V___/ \\\___\
Unobfuscated
<lang REXX>/* Rexx */
drop !top !bot x = 0 x = x + 1; txt.0 = x; txt.x = ' *****' x = x + 1; txt.0 = x; txt.x = ' * *' x = x + 1; txt.0 = x; txt.x = ' * * ***** * * * *' x = x + 1; txt.0 = x; txt.x = ' ***** * * * * *' x = x + 1; txt.0 = x; txt.x = ' * * *** * *' x = x + 1; txt.0 = x; txt.x = ' * * * * * * *' x = x + 1; txt.0 = x; txt.x = ' * * ***** * * * *' x = x + 1; txt.0 = x; txt.x =
call Banner3D isTrue() do ll = 1 to txt.0
say txt.ll.!top say txt.ll.!bot end ll
return exit
Banner3D: procedure expose txt.
drop !top !bot parse arg slope .
select when slope = isTrue() then nop when slope = isFalse() then nop otherwise do if slope = then slope = isFalse() else slope = isTrue() end end
do ll = 1 to txt.0 txt.ll.!top = txt.ll txt.ll.!bot = txt.ll txt.ll.!top = changestr(' ', txt.ll.!top, ' ') txt.ll.!bot = changestr(' ', txt.ll.!bot, ' ') txt.ll.!top = changestr('*', txt.ll.!top, '///') txt.ll.!bot = changestr('*', txt.ll.!bot, '\\\') txt.ll.!top = txt.ll.!top || ' ' txt.ll.!bot = txt.ll.!bot || ' ' txt.ll.!top = changestr('/ ', txt.ll.!top, '/\') txt.ll.!bot = changestr('\ ', txt.ll.!bot, '\/') end ll
if slope then do do li = txt.0 to 1 by -1 ll = txt.0 - li + 1 txt.ll.!top = insert(, txt.ll.!top, 1, li - 1, ' ') txt.ll.!bot = insert(, txt.ll.!bot, 1, li - 1, ' ') end li end
return
exit
isTrue: procedure
return 1 == 1
isFalse: procedure
return \isTrue()</lang>
- Output:
///////////////\ \\\\\\\\\\\\\\\/ ///\ ///\ \\\/ \\\/ ///\ ///\ ///////////////\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\\\\\\\\\\\\\/ \\\/ \\\/ \\\/ \\\/ ///////////////\ ///\ ///\ ///\ ///\ ///\ \\\\\\\\\\\\\\\/ \\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ /////////\ ///\ ///\ \\\/ \\\/ \\\\\\\\\/ \\\/ \\\/ ///\ ///\ ///\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ ///////////////\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\\\\\\\\\\\\\/ \\\/ \\\/ \\\/ \\\/
simpler, shorter
This is a version of the above REXX program (with a minor bug fixed),
the input text has additional spacing between the letters for better readability,
the letter E (in the input text) was widened,
the output doesn't have extraneous leading blanks,
the output doesn't have trailing blanks,
the input text can be any consistent non-blank character except the forward slash (/) or backward slash (\).
<lang rexx>/*REXX pgm draws a "3D" image of text representation; any character except / and \ */
- =7; @.1 = '@@@@ '
@.2 = '@ @ ' @.3 = '@ @ @@@@ @ @ @ @ ' @.4 = '@@@@ @ @ @ @ @ ' @.5 = '@ @ @@@ @ @ ' @.6 = '@ @ @ @ @ @ @ ' @.7 = '@ @ @@@@ @ @ @ @ ' do j=1 for #; x=left(strip(@.j),1) /* [↓] display the (above) text lines.*/ $.1 = changestr( " " , @.j, ' ' ) ; $.2 = $.1 $.1 = changestr( x , $.1, '///' )" " $.2 = changestr( x , $.2, '\\\' )" " $.1 = changestr( "/ ", $.1, '/\' ) $.2 = changestr( "\ ", $.2, '\/' ) do k=1 for 2; say strip(left(,#-j)$.k,"T") /*the LEFT BIF does indentation.*/ end /*k*/ /* [↓] display a line and its shadow.*/ end /*j*/ /*stick a fork in it, we're all done. */</lang>
output when using the default input:
////////////\ \\\\\\\\\\\\/ ///\ ///\ \\\/ \\\/ ///\ ///\ ////////////\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\\\\\\\\\\/ \\\/ \\\/ \\\/ \\\/ ////////////\ ///\ ///\ ///\ ///\ ///\ \\\\\\\\\\\\/ \\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ /////////\ ///\ ///\ \\\/ \\\/ \\\\\\\\\/ \\\/ \\\/ ///\ ///\ ///\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ ////////////\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\\\\\\\\\\/ \\\/ \\\/ \\\/ \\\/
Ruby
<lang Ruby>text = <<EOS
- #
- # #
- # #
- # # ### # #
- # # # # # # #
- # # # # # #
- # ### ### #
# #
EOS
def banner3D_1(text, shift=-1)
txt = text.each_line.map{|line| line.gsub('#','__/').gsub(' ',' ')} offset = Array.new(txt.size){|i| " " * shift.abs * i} offset.reverse! if shift < 0 puts offset.zip(txt).map(&:join)
end banner3D_1(text)
puts
- Other display:
def banner3D_2(text, shift=-2)
txt = text.each_line.map{|line| line.chomp + ' '} offset = txt.each_index.map{|i| " " * shift.abs * i} offset.reverse! if shift < 0 txt.each_with_index do |line,i| line2 = offset[i] + line.gsub(' ',' ').gsub('#','///').gsub('/ ','/\\') puts line2, line2.tr('/\\\\','\\\\/') end
end banner3D_2(text)
puts
- Another display:
def banner3D_3(text)
txt = text.each_line.map(&:rstrip) offset = [*0...txt.size].reverse area = Hash.new(' ') box = [%w(/ / / \\), %w(\\ \\ \\ /)] txt.each_with_index do |line,i| line.each_char.with_index do |c,j| next if c==' ' x = offset[i] + 2*j box[0].each_with_index{|c,k| areax+k,i = c} box[1].each_with_index{|c,k| areax+k,i+1 = c} end end (xmin, xmax), (ymin, ymax) = area.keys.transpose.map(&:minmax) puts (ymin..ymax).map{|y| (xmin..xmax).map{|x| areax,y}.join}
end
banner3D_3 <<EOS
- #
- # #
- # #
- # #
- # # #### # #
- # # # # # # #
- # # # # # # #
- # # # # # #
- # ### #### #
# #
EOS</lang>
- Output:
__/__/__/__/ __/ __/ __/ __/ __/ __/ __/ __/__/__/__/ __/ __/ __/__/__/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/__/__/ __/__/__/ __/ __/ __/ ////////////\ ///\ \\\\\\\\\\\\/ \\\/ ///\ ///\ ///\ \\\/ \\\/ \\\/ ///\ ///\ ///\ \\\/ \\\/ \\\/ ////////////\ ///\ ///\ /////////\ ///\ ///\ \\\\\\\\\\\\/ \\\/ \\\/ \\\\\\\\\/ \\\/ \\\/ ///\ ///\ ///\ ///\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ ///\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ /////////\ /////////\ ///\ \\\/ \\\/ \\\\\\\\\/ \\\\\\\\\/ \\\/ ///\ \\\/ ///\ \\\/ /////////\ ///\ ///\\\\\///\ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ /////////\\\/ ///\ ///\ /////////\ ///\ ///\ ///\///\\\/ ///\/ ///\/ ///\\\\\///\ \///\ ///\\\/ ///\/\///\ ///\/ ///\/ ///\/ ///\/ \///\///\\\/ ///\/ \///\ ///\/ ///\/ ///\/ ///\/ \///\\\/ ///\/ \///\ \///////\/ /////////\\\/ ///\\\/ \\\/ \\\/ \\\\\\\/ \\\\\\\\\/ ///\\\/ ///\\\/ \\\/
Another version: like a 3D solid. <lang Ruby>enc = "9 8u18 2u1\n8 1s 6u1 b16 1s sb\n6 2 s1b4u1s sb13 3 s1\n5 3 s3 3s 11 3 s1\n4 2 s1us3u1su2s 2u4 2u3 2 s1us3u4 2u6 2u1\n4 1s 6u1sbubs2 s1b 2 s1b2 1s 6u1 b2 1susb3 2 s1b\n2 2 s1b2 3u1bs2 8 s1b4u1s s4b 3 s1\n 3 s3b 2 9 s3 3s 3 b2s 1s\n 3s 3 b1 2 s2us4 s1us2u2us1 s3 3 b1s s\nsu2s 2 4 b6u2s 1s7u1sbubs6 1bub2 1s\nbubs6 1bubs2 1b5u1bs b7u1bs8 3 s1\n42 2u2s 1s\n41 1s3u1s s\n41 1b3u1bs\n" def decode(str)
str.split(/(\d+)(\D+)/).each_slice(3).map{|_,n,s| s * n.to_i}.join.tr('sub','/_\\')
end puts decode(enc)</lang>
- Output:
________ __ / ______ \ / /\ / /\____/ /\ / / / / / / / / / / / / / /_/___/_/ / __ __ / /_/___ __ __ / ______/\_\/ / /\ / /\ / ______ \ /_/\ / /\ / /\ ___\/ / / / / / / / /\____/ /\ \ \ \ / / / / / /\ \ \ / / / / / / / / / / / / \ \ \/ / / / / / \ \ \ / /_/_/ / / / /_/___/_/ / \ \ \/ / /_/ / \ \ \ \______/ / /_______/\_\/ \_\ / \_\/ \_\/ \_____\/ \_______\/ / / / __/ / / /___/ / \___\/
Scala
Java style
<lang Scala>def ASCII3D = {
val name = """
* ** ** * * * * * * * * * * * * * * * * * * * *** * *** * * * * * * * * * * * * * * ** ** * * *** * * * * """
// Create Array
def getMaxSize(s: String): (Int, Int) = {
var width = 0 var height = 0
val nameArray = s.split("\n") height = nameArray.size nameArray foreach { i => width = (i.size max width) }
(width, height)
}
val size = getMaxSize(name) var arr = Array.fill(size._2 + 1, (size._1 * 3) + (size._2 + 1))(' ')
// // Map astrisk to 3D cube // val cubeTop = """///\""" //" val cubeBottom = """\\\/""" //"
val nameArray = name.split("\n")
for (j <- (0 until nameArray.size)) {
for (i <- (0 until nameArray(j).size)) { if (nameArray(j)(i) == '*') { val indent = nameArray.size - j arr(j) = arr(j) patch ((i * 3 + indent), cubeTop, cubeTop.size) arr(j + 1) = arr(j + 1) patch ((i * 3 + indent), cubeBottom, cubeBottom.size) } }
}
// // Map Array to String // var name3D = ""
for (j <- (0 until arr.size)) {
for (i <- (0 until arr(j).size)) { name3D += arr(j)(i) } name3D += "\n" } name3D }
println(ASCII3D)</lang>
Idiomatic
Cleaner code. <lang scala>import scala.collection.mutable.ArraySeq
object Ascii3D extends App {
def ASCII3D = { val picture = """ * ** ** * * * * * * * * * * * * * * * * * * * *** * *** * * * * * * * * * * * * * * ** ** * * *** * * * *""".split("\n")
var arr = { val (x, y) = // Get maximal format and create a 2-D array with it. (picture.foldLeft(0)((i, s) => i max s.length), picture.size) ArraySeq.fill(y + 1, (x * 3) + (y + 1))(' ') }
// // Map asterisks to 3D cube // val (cubeTop, cubeBottom) = ("""///\""", """\\\/""") // "
for { y <- 0 until picture.size x <- 0 until picture(y).size if picture(y)(x) == '*' indent = picture.size - y } { arr(y) = arr(y) patch ((x * 3 + indent), cubeTop, cubeTop.size) arr(y + 1) = arr(y + 1) patch ((x * 3 + indent), cubeBottom, cubeBottom.size) } // Transform array to String arr.map(_.mkString).mkString("\n") }
println(ASCII3D)
}</lang>
- Output:
///\ //////\ //////\ ///\ ///\/ ///\ ///\\\\\\\/ ///\\\\\\\/ ///\\\///\ ///\/ ///\\\///\ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ \\///\ ///\/ /////////\/ ///\/ /////////\/ \\///\ ///\/ ///\\\///\/ ///\/ ///\\\///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ //////\\\\/ \\//////\ ///\/ \\///\ /////////\ ///\/ ///\/ \\\\\\/ \\\\\\/ \\\/ \\\/ \\\\\\\\\/ \\\/ ///\/ \\///\ \\\/
Seed7
<lang seed7>$include "seed7_05.s7i";
const array string: name is [] (
" *** * ***** ", "* * * ", "* *** *** **** * ", "* * * * * * * * ", " *** * * * * * * * ", " * ***** ***** * * * ", " * * * * * * ", " * * * * * * ", " *** *** *** **** * ");
const proc: main is func
local var integer: index is 0; var string: help is ""; var string: line is ""; var string: previousLine is ""; var integer: pos is 0; begin for index range 1 to length(name) do help := replace(name[index], " ", " "); line := "" lpad length(name) - index <& replace(replace(help, "*", "///"), "/ ", "/\\"); if previousLine = "" then writeln(line); else for pos range 1 to length(line) do if line[pos] <> ' ' then write(line[pos]); else write(previousLine[pos]); end if; end for; writeln; end if; previousLine := "" lpad length(name) - index <& replace(replace(help, "*", "\\\\\\"), "\\ ", "\\/"); end for; writeln(previousLine); end func;</lang>
- Output:
/////////\ ///\ ///////////////\ ///\\\\\\\\\\/ ///\/ \\\\\\\\\\\///\/ ///\/ /////////\ /////////\ ////////////\/ ///\/ ///\/ ///\\\\\\\\\///\ ///\\\\\\\\\///\ ///\\\\\\\\\///\/ ///\\\\/ \\/////////\ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ \\\\\\\\///\ ///////////////\/ ///////////////\/ ///\/ ///\/ ///\\\\/ ///\/ ///\\\\\\\\\\\\\/ ///\\\\\\\\\\\\\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\/ ///\\\\/ /////////\\\\/ \\/////////\ \\/////////\ \\////////////\/ ///\/ \\\\\\\\\/ \\\\\\\\\/ \\\\\\\\\/ \\\\\\\\\\\\/ \\\/
Sidef
<lang ruby>var text = <<'EOT';
*** * * * ** * * * * * * *** ** *** * **** * * * * * * * ***** * * * * * * * * * * * * * *** * **** *** *
EOT
func banner3D(text, shift=-1) {
var txt = text.lines.map{|line| line.gsub('*','__/').gsub(' ',' ')}; var offset = txt.len.of {|i| " " * (shift.abs * i)}; shift < 0 && offset.reverse!; (offset »+« txt).join("\n");
};
say banner3D(text);</lang>
__/__/__/ __/ __/ __/ __/__/ __/ __/ __/ __/ __/ __/ __/__/__/ __/__/ __/__/__/ __/ __/__/__/__/ __/ __/ __/ __/ __/ __/ __/ __/__/__/__/__/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/ __/__/__/ __/ __/__/__/__/ __/__/__/ __/
SQL
<lang sql>select ' SSS\ ' as s, ' QQQ\ ' as q, 'L\ ' as l from dual union all select 'S \|', 'Q Q\ ', 'L | ' from dual union all select '\SSS ', 'Q Q |', 'L | ' from dual union all select ' \ S\', 'Q Q Q |', 'L | ' from dual union all select ' SSS |', '\QQQ\\|', 'LLLL\' from dual union all select ' \__\/', ' \_Q_/ ', '\___\' from dual union all select ' ', ' \\ ', ' ' from dual;</lang> This works in Oracle. For other databases, try it without "from dual".
- Output:
S Q L ------ ------- ----- SSS\ QQQ\ L\ S \| Q Q\ L | \SSS Q Q | L | \ S\ Q Q Q | L | SSS | \QQQ\\| LLLL\ \__\/ \_Q_/ \___\ \\ 7 rows selected.
Tcl
<lang tcl>package require Tcl 8.5
proc mergeLine {upper lower} {
foreach u [split $upper ""] l [split $lower ""] {
lappend result [expr {$l in {" " ""} ? $u : $l}]
} return [join $result ""]
} proc printLines lines {
set n [llength $lines] foreach line $lines {
set indent [string repeat " " $n] lappend upper $indent[string map {"/ " "/\\"} [ string map {" " " " "*" "///"} "$line "]] lappend lower $indent[string map {"\\ " "\\/"} [ string map {" " " " "*" "\\\\\\"} "$line "]] incr n -1
} # Now do some line merging to strengthen the visual effect set p [string repeat " " [string length [lindex $upper 0]]] foreach u $upper l $lower {
puts [mergeLine $p $u] set p $l
} puts $p
}
set lines {
{***** *} { * *} { * *** *} { * * *} { * * *} { * *** *}
} printLines $lines</lang>
- Output:
///////////////\ ///\ \\\\\///\\\\\\\/ ///\/ ///\/ /////////\ ///\/ ///\/ ///\\\\\\\/ ///\/ ///\/ ///\/ ///\/ ///\/ /////////\ ///\/ \\\/ \\\\\\\\\/ \\\/
UNIX Shell
<lang sh>#!/usr/bin/env bash mapfile -t name <<EOF
- #
- # #
- # #
- ## ### ###
- # # # # #
- # #### ## # #
- # # ## # # #
- ## # ### # #
EOF
main() {
banner3d_1 "${name[@]}" echo banner3d_2 "${name[@]}" echo banner3d_3 "${name[@]}"
}
space() {
local -i n i (( n=$1 )) || n=1 if (( n < 1 )); then n=1; fi for ((i=0; i<n; ++i)); do printf ' ' done printf '\n'
}
banner3d_1() {
local txt i mapfile -t txt < <(printf '%s\n' "$@" | sed -e 's,#,__/,g' -e 's/ / /g') for i in "${!txt[@]}"; do printf '%s%s\n' "$(space $(( ${#txt[@]} - i )))" "${txt[i]}" done
}
banner3d_2() {
local txt i line line2 mapfile -t txt < <(printf '%s \n' "$@") for i in "${!txt[@]}"; do line=${txt[i]} line2=$(printf '%s%s' "$(space $(( 2 * (${#txt[@]} - i) )))" "$(sed -e 's, , ,g' -e 's,#,///,g' -e 's,/ ,/\\,g' <<<"$line")") printf '%s\n%s\n' "$line2" "$(tr '/\\' '\\/' <<<"$line2")" done
}
banner3d_3() {
# hard-coded fancy one cat <<'EOF' ______________ ___________ ___________ ____ ____␣ / /\ / |\ /| \ |\ \ |\ \
/_____________/ /| /___________|| ||___________\| \___\ | \___\␣ | \ / |/ \ / | | | | | | | ________ | | ________ | | _________| | | | | | | | |___| | | | |____| | | |_______ | | |____| | | | | / | | /| | / | | | | \ | | | \ | | | |/_____| |/ | |/_____| | | |________\| | |______\| | | / /| | | \ | | | ______ \ / | _______ | \_________ | | ________ | | | |___| | | | | | | _________/| | | | | | | | | / | | | | | | | | || | | | | | | | |/_____| | /| | | | | |_________|/ | | | \ | | | |/ | | | | | | | | | \| | |_____________/ |___|/ |___| |_____________/ \|___| |___| EOF }
main "$@" </lang>
- Output:
__/__/__/ __/ __/ __/ __/ __/ __/ __/ __/__/__/ __/__/ __/__/__/ __/__/__/ __/ __/ __/ __/ __/ __/ __/ __/ __/__/__/__/ __/__/ __/ __/ __/ __/ __/ __/__/ __/ __/ __/ __/__/__/ __/__/ __/ __/__/__/ __/ __/ /////////\ ///\ \\\\\\\\\/ \\\/ ///\ ///\ ///\ \\\/ \\\/ \\\/ ///\ ///\ ///\ \\\/ \\\/ \\\/ /////////\ //////\ /////////\ /////////\ \\\\\\\\\/ \\\\\\/ \\\\\\\\\/ \\\\\\\\\/ ///\ ///\ ///\ ///\ ///\ ///\ \\\/ \\\/ \\\/ \\\/ \\\/ \\\/ ///\ ///\ ////////////\ //////\ ///\ ///\ \\\/ \\\/ \\\\\\\\\\\\/ \\\\\\/ \\\/ \\\/ ///\ ///\ ///\ //////\ ///\ ///\ ///\ \\\/ \\\/ \\\/ \\\\\\/ \\\/ \\\/ \\\/ /////////\ //////\ ///\ /////////\ ///\ ///\ \\\\\\\\\/ \\\\\\/ \\\/ \\\\\\\\\/ \\\/ \\\/ ______________ ___________ ___________ ____ ____␣ / /\ / |\ /| \ |\ \ |\ \ /_____________/ /| /___________|| ||___________\| \___\ | \___\␣ | \ / |/ \ / | | | | | | | ________ | | ________ | | _________| | | | | | | | |___| | | | |____| | | |_______ | | |____| | | | | / | | /| | / | | | | \ | | | \ | | | |/_____| |/ | |/_____| | | |________\| | |______\| | | / /| | | \ | | | ______ \ / | _______ | \_________ | | ________ | | | |___| | | | | | | _________/| | | | | | | | | / | | | | | | | | || | | | | | | | |/_____| | /| | | | | |_________|/ | | | \ | | | |/ | | | | | | | | | \| | |_____________/ |___|/ |___| |_____________/ \|___| |___|
Visual Basic .NET
<lang vbnet>Module Module1
Sub Main() Console.WriteLine(" ___ ___ ___ ________ ___ ___ ________ ___ ________ ________ ________ ___ ________ ________ _______ _________
|\ \ / /|\ \|\ ____\|\ \|\ \|\ __ \|\ \ |\ __ \|\ __ \|\ ____\|\ \|\ ____\ |\ ___ \|\ ___ \|\___ ___\ \ \ \ / / | \ \ \ \___|\ \ \\\ \ \ \|\ \ \ \ \ \ \|\ /\ \ \|\ \ \ \___|\ \ \ \ \___| \ \ \\ \ \ \ __/\|___ \ \_|
\ \ \/ / / \ \ \ \_____ \ \ \\\ \ \ __ \ \ \ \ \ __ \ \ __ \ \_____ \ \ \ \ \ \ \ \\ \ \ \ \_|/__ \ \ \ \ \ / / \ \ \|____|\ \ \ \\\ \ \ \ \ \ \ \____ \ \ \|\ \ \ \ \ \|____|\ \ \ \ \ \____ __\ \ \\ \ \ \ \_|\ \ \ \ \ \ \__/ / \ \__\____\_\ \ \_______\ \__\ \__\ \_______\ \ \_______\ \__\ \__\____\_\ \ \__\ \_______\ |\__\ \__\\ \__\ \_______\ \ \__\ \|__|/ \|__|\_________\|_______|\|__|\|__|\|_______| \|_______|\|__|\|__|\_________\|__|\|_______| \|__|\|__| \|__|\|_______| \|__| \|_________| \|_________|
")
End Sub
End Module</lang>
- Output:
___ ___ ___ ________ ___ ___ ________ ___ ________ ________ ________ ___ ________ ________ _______ _________ |\ \ / /|\ \|\ ____\|\ \|\ \|\ __ \|\ \ |\ __ \|\ __ \|\ ____\|\ \|\ ____\ |\ ___ \|\ ___ \|\___ ___\ \ \ \ / / | \ \ \ \___|\ \ \\\ \ \ \|\ \ \ \ \ \ \|\ /\ \ \|\ \ \ \___|\ \ \ \ \___| \ \ \\ \ \ \ __/\|___ \ \_| \ \ \/ / / \ \ \ \_____ \ \ \\\ \ \ __ \ \ \ \ \ __ \ \ __ \ \_____ \ \ \ \ \ \ \ \\ \ \ \ \_|/__ \ \ \ \ \ / / \ \ \|____|\ \ \ \\\ \ \ \ \ \ \ \____ \ \ \|\ \ \ \ \ \|____|\ \ \ \ \ \____ __\ \ \\ \ \ \ \_|\ \ \ \ \ \ \__/ / \ \__\____\_\ \ \_______\ \__\ \__\ \_______\ \ \_______\ \__\ \__\____\_\ \ \__\ \_______\ |\__\ \__\\ \__\ \_______\ \ \__\ \|__|/ \|__|\_________\|_______|\|__|\|__|\|_______| \|_______|\|__|\|__|\_________\|__|\|_______| \|__|\|__| \|__|\|_______| \|__| \|_________| \|_________|
XPL0
Here's XPL0's "cheap hack." (Hats off to D!) <lang XPL0>include c:\cxpl\codes;
proc DrawBlock(X, Y); int X, Y; [Cursor(X+1, Y); Text(0, "///\");
Cursor(X, Y+1); Text(0,"/// \"); Cursor(X, Y+2); Text(0,"\\\ /"); Cursor(X+1, Y+3); Text(0, "\\\/");
];
int Data, D, X, Y; [ChOut(0, $C); \form feed, clears screen Data:= [%1000100011110000100000001110,
%1000100010001000100000010001, %0101000010001000100000010011, %0010000011110000100000010101, %0101000010000000100000011001, %1000100010000000100000010001, %1000100010000000111110001110];
for Y:= 0 to 6 do
[D:= Data(Y); for X:= 0 to 27 do [if D&1<<27 then DrawBlock(X*2+(6-Y)*2, Y*2); D:= D<<1; ]; ];
]</lang>
- Output:
///\ ///\ /////////\ ///\ ///////\ /// \ /// \ ///////// \ /// \ /////// \ ///\ / ///\ / ///\\\\\///\/ ///\ / ///\\\\\///\/ /// \/ /// \/ /// \\\/// \ /// \/ /// \\\/// \ \///\///\\\ / ///\ / ///\ / ///\ / ///\ /////\ / /// /// \\\/ /// \/ /// \/ /// \/ /// \///// \/ \///\\\ / /////////\\\ / ///\ / ///\///\///\ / /// \\\/ ///////// \\\/ /// \/ /// /// /// \/ ///\///\/ ///\\\\\\\ / ///\ / /////\\\///\ / /// /// \ /// \\\\\\\/ /// \/ ///// \/// \/ ///\\\ \///\/ ///\ / ///\ / ///\\\ ///\ / /// \\\/// \ /// \/ /// \/ /// \\\/// \/ ///\ / ///\ / ///\ / ///////////\ \///////\\\ / /// \/ /// \/ /// \/ /////////// \ /////// \\\/ \\\ / \\\ / \\\ / \\\\\\\\\\\ / \\\\\\\ / \\\/ \\\/ \\\/ \\\\\\\\\\\/ \\\\\\\/
Yabasic
<lang Yabasic> // Method 1 // r$ = system$("explorer \"http://www.network-science.de/ascii/ascii.php?TEXT=${delegate}&x=23&y=10&FONT=block&RICH=no&FORM=left&STRE=no&WIDT=80&TEXT=Yabasic\"")
// Method 2 // print // print " _| _| _| _| " // print " _| _| _|_|_| _|_|_| _|_|_| _|_|_| _|_|_| " // print " _| _| _| _| _| _| _| _|_| _| _| " // print " _| _| _| _| _| _| _| _|_| _| _| " // print " _| _|_|_| _|_|_| _|_|_| _|_|_| _| _|_|_| " // print
// Method 3 clear screen
dim d$(5)
d$(0) = "X X X XXXX X XXX X XXX " d$(1) = " X X X X X X X X X X X X" d$(2) = " X XXXXX XXXX XXXXX XXX X X " d$(3) = " X X X X X X X X X X X" d$(4) = " X X X XXXX X X XXXX X XXX "
long = len(d$(0))
sub write(dx, dy, c$) local x, y
for y = 0 to 4 for x = 0 to long if mid$(d$(y), x, 1) = "X" print at(x + dx, y + dy) c$ next x next y end sub
write(2, 2, "\\") write(1, 1, "#") print</lang>
zkl
<lang zkl>#<<< " xxxxxx x x x
x x x x x x x x
x x x x xxxxx x x xxxx "
- <<<<
.replace(" "," ").replace("x","_/").println();</lang>
- Output:
_/_/_/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/_/ _/ _/ _/_/_/_/
- Programming Tasks
- Solutions by Programming Task
- GUISS/Omit
- TUSCRIPT/Omit
- 360 Assembly
- Ada
- AutoHotkey
- AWK
- Batch File
- BASIC
- Applesoft BASIC
- BBC BASIC
- FreeBASIC
- Liberty BASIC
- Locomotive Basic
- TI-83 BASIC
- ZX Spectrum Basic
- Befunge
- Brainf***
- C
- C++
- C sharp
- Clojure
- Clj-figlet
- COBOL
- Common Lisp
- Cl-ppcre
- D
- Dart
- Elixir
- Erlang
- ERRE
- F Sharp
- Forth
- Go
- Groovy
- Haskell
- Icon
- Unicon
- J
- Java
- Julia
- Kotlin
- Lasso
- Lua
- Mathematica
- Modula-2
- NetRexx
- Nim
- OCaml
- Pascal
- Perl
- Perl 6
- Phix
- PicoLisp
- PureBasic
- Python
- Python examples needing attention
- Examples needing attention
- Racket
- Raven
- REXX
- Ruby
- Scala
- Seed7
- Sidef
- SQL
- Tcl
- UNIX Shell
- Visual Basic .NET
- XPL0
- Yabasic
- Zkl