Write language name in 3D ASCII: Difference between revisions

→‎{{header|Python}}: Beautified Impl 1 and 2
m (syntax highlighting fixup automation)
(→‎{{header|Python}}: Beautified Impl 1 and 2)
Line 2,856:
<b>Implementation 1:</b> based on the Scala type idea of 'fleshing out' a 2D banner version.
<syntaxhighlight lang="python">py = '''\
##### # # ##### # # #### # #
# # # # # # # # # ## #
# ### # # ###### # # # # #
##### # # # # # # # # #
# # # # # ### # # ##'''
 
# # # # # #### # #
lines = py.replace('#', '<<<').replace(' ','X').replace('X', ' ').replace('\n', ' Y').replace('< ', '<>').split('Y')
'''
.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):
print( ' ' * (len(lines) - i) + l)</syntaxhighlight>
 
{{out}}
<pre> style="overflow-x: auto; white-space: pre;"> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<>
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<>
<<<> <<<<<<<<<> <<<> <<<> <<<<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<>
<<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<>
<<<> <<<> <<<> <<<> <<<> <<<<<<<<<> <<<> <<<> <<<<<</pre>
<<<> <<<> <<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<></pre>
 
<b>Implementation 2:</b>
<syntaxhighlight lang="python">charWidth = 10
charHeight = 8
 
# char table is split into sets to prevent very long lines...
charSet1 = [
" / ###### /####### / ###### /###### /######## /######## / ###### /## /##",
"| /##__ ##| ##__ ##| /##__ ##| ##__ ## | ##_____/| ##_____/| /##__ ##| ## | ##",
"| ## \| ##| ## \| ##| ## \__/| ## \ ##| ## | ## | ## \__/| ## | ##",
"| ########| ####### | ## | ## | ##| ########| ########| ## #####| ########",
"| ##__ ##| ##__ ##| ## | ## | ##| ##_____/| ##_____/| ##|_ ##| ##__ ##",
"| ## | ##| ## \| ##| ## /##| ## /##/| ## | ## | ## | ##| ## | ##",
"| ## | ##| #######/| ######/| ######/ | ########| ## | ######/| ## | ##",
"|__/ |__/|_______/ \______/ |______/ |________/|__/ \______/ |__/ |__/",
Line 2,893:
 
charSet2 = [
" /######## /## /## /## /## /### / ### /## /## / ###### /####### ",
"|__ ##__/ | ##| ## /##/| ## | ########| ### | ##| /##__ ##| ##__ ##",
" | ## | ##| ## /##/ | ## | ## ## ##| ####| ##| ## \| ##| ## \| ##",
" | ## | ##| #####/ | ## | ## ## ##| ## ## ##| ## | ##| #######/",
" | ## | ##| ## ## | ## | ## ## ##| ## ####| ## | ##| ##____/ ",
Line 2,904:
 
charSet3 = [
" / ###### /####### / ###### /######## /## /## /## /## /## /## /## /##",
"| /##__ ##| ##__ ##| /##__ ##|__ ##__/| ## | ##| ## | ##| ## | ##\ ## /##/",
"| ## \| ##| ## \| ##| ## \__/ | ## | ## | ##| ## | ##| ## ## ## \ ####/ ",
"| ## | ##| #######/ \ ###### | ## | ## | ##| ## | ##| ## ## ## \ ##/ ",
"| ## ## ##| ## ## \___ ## | ## | ## | ##| ## / ##/| ## ## ## / #### ",
"| ##\ ###/| ##\ ## /## \ ## | ## | ## | ## \ ####/ | ######## / ## ## ",
"| #### ##| ## \ ##\ ######/ | ## | ######/ \ ##/ | ###| ###/ ## \ ##",
Line 2,915:
 
charSet4 = [
" /## /## /######## / ###### ",
"\ ## /##/|____ ##/| /##__ ## ",
" \ ####/ / ##/ | ## \| ## ",
" \ ##/ / ##/ |__//####/ ",
" | ## / ##/ | ##_/ ",
Line 2,935:
if not text:
text = "PYTHON"
 
for i in range(charHeight):
lineOut = ""
Line 2,952:
 
{{out}}
<pre> /####### /## /## /######## /## /## / ###### /## /##
| ##__ ##\ ## /##/|__ ##__/| ## | ##| /##__ ##| ### | ##
| ## \| ## \ ####/ | ## | ## | ##| ## \| ##| ####| ##
| #######/ \ ##/ | ## | ########| ## | ##| ## ## ##
| ##____/ | ## | ## | ##__ ##| ## | ##| ## ####
535

edits