Write language name in 3D ASCII: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
(→‎{{header|Python}}: Beautified Impl 1 and 2)
Line 2,856: Line 2,856:
<b>Implementation 1:</b> based on the Scala type idea of 'fleshing out' a 2D banner version.
<b>Implementation 1:</b> based on the Scala type idea of 'fleshing out' a 2D banner version.
<syntaxhighlight lang="python">py = '''\
<syntaxhighlight lang="python">py = '''\
##### # # ##### # # #### # #
#### # # ##### # # ### # #
# # # # # # # # # ## #
# # # # # # # # # ## #
# # # # ###### # # # # #
#### # # ##### # # # # #
##### # # # # # # # # #
# # # # # # # # ##
# # # # # # # # ##
# # # # # ### # #'''

# # # # # #### # #
lines = py.replace('#', '<<<').replace(' ','X') \
'''
.replace('X', ' ').replace('\n', ' Y') \
.replace('< ', '<>').split('Y')


lines = py.replace('#', '<<<').replace(' ','X').replace('X', ' ').replace('\n', ' Y').replace('< ', '<>').split('Y')
for i, l in enumerate(lines):
for i, l in enumerate(lines):
print( ' ' * (len(lines) - i) + l)</syntaxhighlight>
print(' ' * (len(lines) - i) + l)</syntaxhighlight>


{{out}}
{{out}}
<pre> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<>
<pre style="overflow-x: auto; white-space: pre;"> <<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<> <<<> <<<>
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<>
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<>
<<<> <<<> <<<> <<<> <<<<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<>
<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<>
<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<>
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<>
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<>
<<<> <<<> <<<> <<<> <<<> <<<<<<<<<> <<<> <<<</pre>
<<<> <<<> <<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<></pre>


<b>Implementation 2:</b>
<b>Implementation 2:</b>
<syntaxhighlight lang="python">charWidth = 10
<syntaxhighlight lang="python">charWidth = 10
charHeight = 8
charHeight = 8

# char table is split into sets to prevent very long lines...
# char table is split into sets to prevent very long lines...
charSet1 = [
charSet1 = [
" /###### /####### /###### /###### /######## /######## /###### /## /##",
" ###### /####### ###### /###### /######## /######## ###### /## /##",
"| ##__ ##| ##__ ##| ##__ ##| ##__ ## | ##_____/| ##_____/| ##__ ##| ## | ##",
" /##__ ##| ##__ ## /##__ ##| ##__ ## | ##_____/| ##_____/ /##__ ##| ## | ##",
"| ## \ ##| ## \ ##| ## \__/| ## \ ##| ## | ## | ## \__/| ## | ##",
"| ## | ##| ## | ##| ## \__/| ## \ ##| ## | ## | ## \__/| ## | ##",
"| ########| ####### | ## | ## | ##| ########| ########| ## #####| ########",
"| ########| ####### | ## | ## | ##| ########| ########| ## #####| ########",
"| ##__ ##| ##__ ##| ## | ## | ##| ##_____/| ##_____/| ##|_ ##| ##__ ##",
"| ##__ ##| ##__ ##| ## | ## | ##| ##_____/| ##_____/| ##|_ ##| ##__ ##",
"| ## | ##| ## \ ##| ## /##| ## /##/| ## | ## | ## | ##| ## | ##",
"| ## | ##| ## | ##| ## /##| ## /##/| ## | ## | ## | ##| ## | ##",
"| ## | ##| #######/| ######/| ######/ | ########| ## | ######/| ## | ##",
"| ## | ##| #######/| ######/| ######/ | ########| ## | ######/| ## | ##",
"|__/ |__/|_______/ \______/ |______/ |________/|__/ \______/ |__/ |__/",
"|__/ |__/|_______/ \______/ |______/ |________/|__/ \______/ |__/ |__/",
Line 2,893: Line 2,893:


charSet2 = [
charSet2 = [
" /######## /## /## /## /## /### /### /## /## /###### /####### ",
" /######## /## /## /## /## /### ### /## /## ###### /####### ",
"|__ ##__/ | ##| ## /##/| ## | ########| ### | ##| ##__ ##| ##__ ##",
"|__ ##__/ | ##| ## /##/| ## | ########| ### | ## /##__ ##| ##__ ##",
" | ## | ##| ## /##/ | ## | ## ## ##| ####| ##| ## \ ##| ## \ ##",
" | ## | ##| ## /##/ | ## | ## ## ##| ####| ##| ## | ##| ## | ##",
" | ## | ##| #####/ | ## | ## ## ##| ## ## ##| ## | ##| #######/",
" | ## | ##| #####/ | ## | ## ## ##| ## ## ##| ## | ##| #######/",
" | ## | ##| ## ## | ## | ## ## ##| ## ####| ## | ##| ##____/ ",
" | ## | ##| ## ## | ## | ## ## ##| ## ####| ## | ##| ##____/ ",
Line 2,904: Line 2,904:


charSet3 = [
charSet3 = [
" /###### /####### /###### /######## /## /## /## /## /## /## /## /##",
" ###### /####### ###### /######## /## /## /## /## /## /## /## /##",
"| ##__ ##| ##__ ##| ##__ ##|__ ##__/| ## | ##| ## | ##| ## | ##\ ## /##/",
" /##__ ##| ##__ ## /##__ ##|__ ##__/| ## | ##| ## | ##| ## | ##\ ## /##/",
"| ## \ ##| ## \ ##| ## \__/ | ## | ## | ##| ## | ##| ## ## ## \ ####/ ",
"| ## | ##| ## | ##| ## \__/ | ## | ## | ##| ## | ##| ## ## ## \ ####/ ",
"| ## | ##| #######/ \ ###### | ## | ## | ##| ## | ##| ## ## ## \ ##/ ",
"| ## | ##| #######/ \ ###### | ## | ## | ##| ## | ##| ## ## ## \ ##/ ",
"| ## ## ##| ## ## \___ ## | ## | ## | ##| ## /##/| ## ## ## / #### ",
"| ## ## ##| ## ## \___ ## | ## | ## | ##| ## ##/| ## ## ## / #### ",
"| ##\ ###/| ##\ ## /## \ ## | ## | ## | ## \ ####/ | ######## / ## ## ",
"| ##\ ###/| ##\ ## /## \ ## | ## | ## | ## \ ####/ | ######## / ## ## ",
"| #### ##| ## \ ##\ ######/ | ## | ######/ \ ##/ | ###| ###/ ## \ ##",
"| #### ##| ## \ ##\ ######/ | ## | ######/ \ ##/ | ###| ###/ ## \ ##",
Line 2,915: Line 2,915:


charSet4 = [
charSet4 = [
" /## /## /######## /###### ",
" /## /## /######## ###### ",
"\ ## /##/|____ ##/| ##__ ## ",
"\ ## /##/|____ ##/ /##__ ## ",
" \ ####/ / ##/ | ## \ ## ",
" \ ####/ / ##/ | ## | ## ",
" \ ##/ / ##/ |__//####/ ",
" \ ##/ / ##/ |__//####/ ",
" | ## / ##/ | ##_/ ",
" | ## / ##/ | ##_/ ",
Line 2,935: Line 2,935:
if not text:
if not text:
text = "PYTHON"
text = "PYTHON"

for i in range(charHeight):
for i in range(charHeight):
lineOut = ""
lineOut = ""
Line 2,952: Line 2,952:


{{out}}
{{out}}
<pre> /####### /## /## /######## /## /## /###### /## /##
<pre> /####### /## /## /######## /## /## ###### /## /##
| ##__ ##\ ## /##/|__ ##__/| ## | ##| ##__ ##| ### | ##
| ##__ ##\ ## /##/|__ ##__/| ## | ## /##__ ##| ### | ##
| ## \ ## \ ####/ | ## | ## | ##| ## \ ##| ####| ##
| ## | ## \ ####/ | ## | ## | ##| ## | ##| ####| ##
| #######/ \ ##/ | ## | ########| ## | ##| ## ## ##
| #######/ \ ##/ | ## | ########| ## | ##| ## ## ##
| ##____/ | ## | ## | ##__ ##| ## | ##| ## ####
| ##____/ | ## | ## | ##__ ##| ## | ##| ## ####