Minecraft Mirrored

50

1

This is Calvin. Just trying to get 20 rep so this user can chat in the PPCG Minecraft Server chatroom.

Write a program or function that takes in a positive integer.

If the integer is even (2, 4, 6, ...), print or return this exact ASCII art string:

                       __    __   __             __  ___
  /\  /\    |  |\  |  |     /    |  |     /\    |     |
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   |
/        \  |  |  \|  |__   \__  |   \  /    \  |     |

If the integer is odd (1, 3, 5, ...), print or return this exact ASCII art string:

                       __    __
\        /  |  |  /|  |     /    |   /  \ __ /  |     |
 \  /\  /   |  | / |  |--  |     |--/    \  /   |--   |
  \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_

You may assume the input is always a positive integer.

In both output cases there may optionally be any number of trailing spaces up to the right edge of the "T" on each line, and/or a single trailing newline. Note how there are two columns of spaces between each letter.

The shortest code in bytes wins.

Old Chat Relay

Posted 2015-07-27T17:57:08.457

Reputation: 617

54I'd name-drop Calvin too if I was a new user looking for rep ;) – Geobits – 2015-07-27T18:01:22.913

13@Geobits It's me. – Calvin's Hobbies – 2015-07-27T18:02:32.427

52@Geobits No, its me. I knew no-one would upvote if I revealed its actually me. – Optimizer – 2015-07-27T18:03:09.840

1Shouldn't the "M" in "Minecraft" have vertical legs? – mbomb007 – 2015-07-27T18:22:27.487

3@mbomb007 I prefer it this way. – Old Chat Relay – 2015-07-27T18:25:59.070

1Okay, it's just that the Minecraft logo has a vertically-legged 'M'. – mbomb007 – 2015-07-27T21:44:34.007

19Why does it matter who created it? Shouldnt the rep be based on the content of the post? – marsh – 2015-07-28T17:55:15.497

19@marsh In theory, yes. In reality, people are flawed. It'd be an interesting experiment to run, having a high-rep user create a new account to post a few challenges to gauge the difference in reception. – Geobits – 2015-07-28T19:10:38.127

@Geobits but then the name-dropping would already pollute the sample. Need more params to run the experiment. – Mindwin – 2015-07-28T22:01:58.270

1@Mindwin Oh, sure this one's polluted. My name-dropping comment was explicitly calling out that likely effect in a (IMO) humorous way. – Geobits – 2015-07-28T22:13:11.953

xD I had what I thought was working in only like 100 something bytes, but I forgot to reverse the /s and the \s and the _s so i failed... – Oliver Ni – 2015-07-29T01:13:13.613

In both output cases there may optionally be any number of trailing spaces up to the right edge of the "T" on each line, and/or a single trailing newline. Does this mean the trailing newline on the last line is optional? – samgak – 2015-07-29T02:08:31.787

@samgak Correct. – Old Chat Relay – 2015-07-29T04:31:51.990

@Geobits a la Richard Bachman

– Kik – 2015-07-29T14:29:31.733

@cairdcoinheringaahing I can understand good humor. So if I don't laugh, now you know why. – Geobits – 2017-06-08T17:16:44.597

Answers

23

JavaScript (ES6), 343 336 289 267 265 260 bytes

Just for fun... :) (Thanks to Xufox for cutting off 46 bytes, and encouraging me to cut off another 37 on my own.)

n=>`887141${n%2?`
98/202/05/4|3/29 1 /2|5|
 92/92/30 / 0--2|5|--/492/3|--3|
29/29/40/2013912|1|59/4|12_|_`:`3185121_
2/92/9409205/405/94|5|
 /29/2930 9 0--2|5|--94/193|--3|
/892029013912|392/492|5|`}`.replace(/\d/g,x=>+x?x<2?'__':x<9?' '.repeat(x):'\\':'|  |')

Called as a(4) or similar. Try it here:

a=n=>`887141${n%2?`
98/202/05/4|3/29 1 /2|5|
 92/92/30 / 0--2|5|--/492/3|--3|
29/29/40/2013912|1|59/4|12_|_`:`3185121_
2/92/9409205/405/94|5|
 /29/2930 9 0--2|5|--94/193|--3|
/892029013912|392/492|5|`}`.replace(/\d/g,x=>+x?x<2?'__':x<9?' '.repeat(x):'\\':'|  |')
document.getElementById("a").innerHTML = "<pre>"+a(2)+"</pre>";
document.getElementById("b").innerHTML = "<pre>"+a(3)+"</pre>";
<p id="a"></p>
<p id="b"></p>

I've condensed the whitespace into strings of digits from 2 to 8 (e.g. 887 = 23 spaces). Each digit is then replaced with the corresponding number of spaces. 0 represents | |, and 1 represents __. All in all, this program is 170 bytes shorter than the two strings combined (203 + 227 = 430), so I'm happy. :)

Edit: Somehow, it's exactly the same length as the only other entry at this point.... o_o

Edit 2: Saved some space by changing n%2<1? to n%2? and swapping the strings. Also took advantage of the fact that the beginnings of the two strings are the same to reduce another 5 bytes.

Edit 3: |2| seemed to show up an awful lot, so simplified each occurence to x, saving 7 bytes. Xufox's suggestions cut off another 40 bytes.

Edit 4: Xufox's suggestion to replace \n with actual line breaks paid off, removing 6 bytes from the total. Changing x to 0 and __ to 1 (insert evil laugh here), then combining all of the (insert plural of Regex here), as he did in his entry, saved an extra 16 bytes.

Edit 5: Since I've chosen to use the ES6 standards, I used custom template string interpolation to shave off 2 final bytes.

ETHproductions

Posted 2015-07-27T17:57:08.457

Reputation: 47 880

1That number must have something to it! In addition to being a perfect cube, that is :-) Can't vote on your answer since I have no idea of JavaScript... – Luis Mendo – 2015-07-27T23:52:53.317

Put r='replace' in your first [r], i.e. [r='replace']. – user42589 – 2015-07-28T23:30:48.713

1How about .replace(/\d/g,d=>' '.repeat(d))? – user42589 – 2015-07-29T00:04:08.480

@Xufox: Thanks a ton! Your first tip saves one byte, and the second saves another 38 (!!!). – ETHproductions – 2015-07-29T00:36:37.007

1@ETHproductions Nice! Now, can you beat my answer? Only 9 bytes to go… ;) By the way, when I count your bytes it says 289, using the gEdit counting tool… – user42589 – 2015-07-29T00:45:19.497

@Xufox: My bad, it seems that I had forgotten to remove an extraneous line break from the end of the code, after copy-pasting it into Notepad++. Perhaps I could use some tricks from your answer to golf mine even further. :) – ETHproductions – 2015-07-29T00:56:19.850

1Maybe using template strings to be able to make actual line breaks instead of \n, saving one byte per line break? – user42589 – 2015-07-29T00:59:11.737

Thanks for the tip! That saved me 6 bytes, and I managed to save another 16 by changing x to 0, __ to 1, and combining the three (Regexes? Regices? Regi?) into one. That leaves mine at 14 bytes less than yours. :) Any other suggestions? – ETHproductions – 2015-07-29T01:27:55.930

That’s just amazing! I didn’t think it was possible! – user42589 – 2015-07-29T01:38:59.163

@Xufox There, I'm done. I shaved off two final bytes by using ES6's custom template string interpolation, but I don't think it's possible to go any further. But maybe I'm wrong... – ETHproductions – 2015-07-29T02:35:56.127

Hm… did you remove any unnecessary trailing spaces? – user42589 – 2015-07-29T08:03:16.703

Yeah, that was actually the first thing I did before condensing the whitespace. – ETHproductions – 2015-07-29T12:18:22.383

1Now I’ve got 2 bytes less than you. =P – user42589 – 2015-07-30T09:22:44.067

Darn.... Nice job :)

I love this highly competitive nature of code golf! Now, let's see if we can golf even further. >:-D – ETHproductions – 2015-07-30T13:52:09.573

12

Matlab, 343 341

a=' -/\_|';
if mod(input(''),2)
x='003C00E00E000L0005N5000I000005550I0000I0055N4UVYO26R4004400400U005300UUXO060O060003C00C30CO00IO00UUUS060S5B54000';else
x='0I2000L0000L000E05H50C0000000555000C00C00H554UVYO26R4004400400U000250WUU006O006O0I2002I00O0I0O0C0UUU006S05BT0004';end
disp(a(reshape(dec2base(base2dec(reshape(x,[],7),36),6),4,[])-47))

The input number is provided from stdin.

Sample run:

>> a=' -/\_|';
if mod(input(''),2)
x='003C00E00E000L0005N5000I000005550I0000I0055N4UVYO26R4004400400U005300UUXO060O060003C00C30CO00IO00UUUS060S5B54000';else
x='0I2000L0000L000E05H50C0000000555000C00C00H554UVYO26R4004400400U000250WUU006O006O0I2002I00O0I0O0C0UUU006S05BT0004';end
disp(a(reshape(dec2base(base2dec(reshape(x,[],7),36),6),4,[])-47))
1
                       __    __   __             __  ___
  /\  /\    |  |\  |  |     /    |  |     /\    |     | 
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   | 
/        \  |  |  \|  |__   \__  |   \  /    \  |     | 

Luis Mendo

Posted 2015-07-27T17:57:08.457

Reputation: 87 464

1That's just crazy lol. +1. – rayryeng - Reinstate Monica – 2015-07-28T05:27:50.753

1@rayryeng Yeah :-) Pity that Matlab only allows base up to 36. A larger value would have saved quite a few bytes – Luis Mendo – 2015-07-28T10:02:12.090

1@LuisMendo Exactly what I thought while making my JavaScript solution… – user42589 – 2015-07-28T21:20:51.190

@Xufox in JS the btoa() and atob() functions are base64 encode and decode, respectively. – clap – 2015-08-17T04:56:39.197

11

CJam, 158 149 145 138 bytes

li2%"A+×rµ^ÅÆÿ»£ºoU#ü T^U^ÝZe<ÄÊKÞÒ£^ÛWWø5Úí§¹T^Úêer^^°^Ã}Ã^A0R2"281b7b"/
 -_\|"f=N/S3**_"_ ":T/TW%*4/zW%1m>N*1>"\/"_W%er"^W^]5OU"{i_32>T=t}/\4/zN*?

The above uses caret notation, since the code contains unprintable characters.

Try it online in the CJam interpreter.

If the permalink doesn't work in your browser, you can copy the code from this paste.

Example run

$ LANG=en_US
$ xxd -ps -r > minecraft.cjam <<< 6c69322522412bd772b585c6ffbba3ba6f5523fc2054159d5a653cc4ca4bded2a39b5757f835daeda7b9549aea65721eb0837dc30130523222323831623762222f0a202d5f5c7c22663d4e2f53332a2a5f225f20223a542f5457252a342f7a5725316d3e4e2a313e225c2f225f5725657222171d354f55227b695f33323e543d747d2f5c342f7a4e2a3f
$ cjam minecraft.cjam <<< 2; echo
                       __    __   __             __  ___
  /\  /\    |  |\  |  |     /    |  |     /\    |     | 
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   | 
/        \  |  |  \|  |__   \__  |   \  /    \  |     | 
$ cjam minecraft.cjam <<< 1; echo
                       __    __                        
\        /  |  |  /|  |     /    |   /  \ __ /  |     | 
 \  /\  /   |  | / |  |--  |     |--/    \  /   |--   | 
  \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_

Idea

Instead of encoding the MINECRAFT string (padded to achieve a constant line length) directly, we'll encode a "zipped" version of it, where rows and columns have been transposed.

After zipping and removing the linefeeds, this string (let's call it R) has to be encoded:

   /  /  /   \    \   /  /   \    \    \         |||         ||| \    \    \ |||         |||_ -__ -_          |  / \_  __  _         |||_ - _ -  |\    \           /  /  /_  \_   \    \         |||_ - _ -         _   _|||_   

There are many runs of spaces, so we'll replace each occurrence of a space triplet with a linefeed.

This leaves us with seven different characters (\n -/\_|), so we assign each of them a number from 0 to 6 and consider the resulting array digits of a base 7 number, which we then encode as a byte string.

Decoding works by reversing the steps from above.

The mirrored string can be constructed from the original one.

If we reverse the order of the four rows and swap the soliduses, we obtain the following:

\        /  |  |  /|  |__   /__  |   /  \    /  |     | 
 \  /\  /   |  | / |  |--  |     |--/    \__/   |--   | 
  \/  \/    |  |/  |  |     \    |  |     \/    |     | 
                       __    __   __             __  ___

Somehow similar, but we'll clearly have to rotate the rows to bring the bottom row to the top:

                       __    __   __             __  ___
\        /  |  |  /|  |__   /__  |   /  \    /  |     | 
 \  /\  /   |  | / |  |--  |     |--/    \__/   |--   | 
  \/  \/    |  |/  |  |     \    |  |     \/    |     | 

That would be it if it wasn't for those pesky underscores.

If we read the original string from top to bottom and ignore linefeeds (thus obtaining R) and replace each underscore followed by space with a space followed by an underscore before shifting the rows, this is the result:

                         _     _                      _ 
\        /  |  |  /|  |_    /_   |   /  \ __ /  |     | 
 \  /\  /   |  | / |  |--  |     |--/    \  /   |--   | 
  \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_

Much better! All that's left to do is deleting the first space of the first row (shifting all underscores in the first row one character left), moving the misplaced underscores in E and C one row up and discarding the underscore over T.

Code

li2%           e# Read an integer from STDIN and push its parity.

"A+×rµ^ÅÆÿ»£ºoU#ü T^U^ÝZe<ÄÊKÞÒ£^ÛWWø5Úí§¹T^Úêer^^°^Ã}Ã^A0R2"

281b7b         e# Convert the byte string from base 281 to base 7.
"/\n -_\\|"f=  e# Replace each digit by its corresponding character.
N/S3**         e# Turn linefeeds into three spaces.
_              e# Copy the resulting string.
"_ ":T         e# Define T.
/TW%*          e# Replace occurrences of T with T reversed.
4/z            e# Split into chunks of length 4 and zip.
W%1m>          e# Reverse and rotate the rows.
N*             e# Join the rows, separating by linefeeds.
1>             e# Discard the first character.
"\/"_W%er      e# Swap the soliduses.
"^W^]5OU"      e# Push the string that corresponds to [23 29 53 79 85].
{              e# For each character:
  i            e#   Push its code point.
   _32>        e#   Push 1 iff the code point is larger than 32.
       T=      e#   Select the element at that index from T = "_ ".
         t     e#   Replace the element at the code point's index with that char.
}/             e#
\              e# Swap the partially generated MINECARFT string on top.
4/z            e# Split into chunks of length 4 and zip.
N*             e# Join the rows, separating by linefeeds.
?              e# Select the first string iff the input was odd.

Dennis

Posted 2015-07-27T17:57:08.457

Reputation: 196 637

How does it work? – anatolyg – 2015-07-28T17:59:43.227

@anatolyg I've edited my answer. – Dennis – 2015-07-28T23:23:37.337

10

Pyth - 182 bytes

Uses base encoding approach. Since indexing is modular in Pyth, I don't even have to do anything for the even odd, just put it in the correct order, and use @Q. As a bonus this also works with negative numbers.

@mjbcs@L"_| /\\-"jCd6 56,"EWbòH\x00B)þK٣ĭIOõìæ«FFãbÐÄBØ\«¼,vã<RN>­º:w÷ò¾<éifP9e|ÉWf!FÔèà""EWbòH\x00B)þOHÿ$@ËþçX'D[¾«Â?°´=&£üá ¹»ázH×Æz3äkÕg{`!|ðY!ðGV"Q

I had tries only encoding the first one, then flipping and switching the slashes, but the first and last line were too hard.

I could save 6 bytes by putting actual null bytes in the code, but that's too much trouble.

Try it online here.

It looks really bad online because the output box is too small and wraps. I recommend fiddling with the dev-console and changing the col-md-5 to a col-md-7.

Maltysen

Posted 2015-07-27T17:57:08.457

Reputation: 25 023

The two strings have a bunch of duplicated characters, you can remove 11 bytes like so.

– PurkkaKoodari – 2015-07-28T14:34:25.807

8

JavaScript (ES6), 312, 285, 281, 272, 270, 263, 262, 260

For previous edits see the edit history.

Edit 5: In the conversion, I switched the number associated with - (now 0) and whitespace (now 1). In the resulting block, the numbers 1, 2 and 3 weren’t used as much anymore. This allowed me to use an array with the missing numbers.

Edit 6: Improved the array literal. I tried this previously, but used 777 and 77 as strings instead of numbers and noticed only now that I had missed this.

Edit 7: The “Golfed code” is a function, as specified by the question and there’s no need for f= to meet this specification. Thus, removing it, saving two bytes.


Runnable in Firefox 39:

// Testing:

f=

// Golfed code:

n=>[...`11111113ss17ss1pp11117pp3ppp
97dj3dj7822j78z213e17z3v8397gm78212
7f3kf3k1z27k7z20021200k17fppk1z001z
d7983987j2287jz2ss1lss2aabj3d7987j2aa3aza`.replace(/[123]/g,x=>[,777,'77z',77][x])].map(a=>isNaN(i=parseInt(a,36))?a:'- /\\_|'[n%2?i%6:~~(i/6)]).join``

// Testing:

;document.body.appendChild(document.createElement('pre')).innerHTML=f(0);
document.body.appendChild(document.createElement('pre')).innerHTML=f(1);
document.body.appendChild(document.createElement('pre')).innerHTML=f(2);
document.body.appendChild(document.createElement('pre')).innerHTML=f(35);

It’s based on the base 6 number system and each ASCII character stands for a number:

"-": 0
" ": 1
"/": 2
"\": 3
"_": 4
"|": 5

Then, I’ve combined the number representation of each ASCII string. For example: when the first ASCII string contains a / at one position and the other one contains a \ at the same position, that position becomes 32, which is base 6 (20 in decimal). If you convert this to base 36 (to get one base-36 number for every two base-6 numbers), you get k.

All this was done beforehand and the function basically undoes this process.

Now the two JavaScript answers both have one other answer each, that has the same byte count…


PS: As a note to myself and a reference to others, this is the code I used:

// 1. ASCII here
a=`|\\-/ _`;

// 2. ASCII here
b=`/|\\_ -`;

// Note: the ASCII strings’ backslashes have to be escaped!

[...a]
  .map((c,i)=>parseInt((c+b[i])
    .replace(/-/g,'0')
    .replace(/ /g,'1')
    .replace(/\//g,'2')
    .replace(/\\/g,'3')
    .replace(/_/g,'4')
    .replace(/\|/g,'5'),6))
  .map(c=>isNaN(c)
    ?`
`
    :c.toString(36))
  .join``
// Returns "wn3g7o", which is then put into the function as the block at the top.

user42589

Posted 2015-07-27T17:57:08.457

Reputation: 230

2Gosh, why is ~NaN == -1?! – user42589 – 2015-07-29T08:08:55.213

I also thought about reversing the ASCII strings line by line, to get rid of yet more trailing spaces (it also saved two bytes in the replacement: […][x]+77, 77 doesn’t need to be a string anymore), but the additional reversing in the golfed code didn’t make it worth it… – user42589 – 2015-07-30T09:56:42.213

I didn't understand this when I first read it a year ago, but now I see the technique. Combining every pair of chars into one is very clever :-) I think you can replace isNaN with 1+, and ~~(i/6) with i/6|0. – ETHproductions – 2016-09-28T21:13:23.113

Haha, I'm now a byte ahead ;) – ETHproductions – 2016-11-14T21:03:04.527

@ETHproductions Well, hold on a second… I just noticed that you don’t have the f= at the beginning, but I do. I also read that it’s accepted to remove it, thus I’ll do so myself, and now I have 260 bytes. ;) – user42589 – 2016-11-14T21:18:37.807

Well, I found one more byte to golf off my function, so... I guess we'll call it a tie? – ETHproductions – 2016-11-14T21:56:39.497

@ETHproductions Wow, neat. Yes, it’s a tie for now, I guess… – user42589 – 2016-11-14T22:33:04.813

6

CJam, 136 bytes

"^ASÓ8¥È÷^K¯¾/^HÕ2^ÄË1jÒÝ^D^Á0îl;)HR§û|^Ê^Þ^ÇÝÅ^ßNlz^TfÑ^Øj>À^à 4#bH\¿^Äî·íì^E^A~(¿ø³(ú´,^È(¡j>è?#'»vçPïju87)×"
265b8b[S9*'|3*+S2*]"/-_\| "+f=s4/56/ri=zN*

The above uses caret notation, since the code contains unprintable characters.

The linefeed is solely for "readability". Try it online in the CJam interpreter.

If the permalink doesn't work in your browser, you can copy the code from this paste.

Example run

$ LANG=en_US
$ xxd -ps -r > minecraft.cjam <<< 220153d338a5c8f70bafbe2f08d53284cb316ad2dd048130ee6c3b294852a7fb7c8a9e87ddc59f4e6c7a1466d1986a3ec08320342362485cbf84eeb7edec05017e28bff8b328fab42c8828a16a3ee83f2327bb76e750ef6a75383729d7223236356238625b53392a277c332a2b53322a5d222f2d5f5c7c20222b663d73342f35362f72693d7a4e2a
$ cjam minecraft.cjam <<< 2; echo
                       __    __   __             __  ___
  /\  /\    |  |\  |  |     /    |  |     /\    |     | 
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   | 
/        \  |  |  \|  |__   \__  |   \  /    \  |     | 
$ cjam minecraft.cjam <<< 1; echo
                       __    __                        
\        /  |  |  /|  |     /    |   /  \ __ /  |     | 
 \  /\  /   |  | / |  |--  |     |--/    \  /   |--   | 
  \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_

Idea

This approach has some similarities to the one in my other answer, but it is a lot simpler and (rather disappointingly) a bit shorter.

We search for a way to encode the following string:

                       __    __   __             __  ___                       __    __                         
  /\  /\    |  |\  |  |     /    |  |     /\    |     | \        /  |  |  /|  |     /    |   /  \ __ /  |     | 
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   |  \  /\  /   |  | / |  |--  |     |--/    \  /   |--   | 
/        \  |  |  \|  |__   \__  |   \  /    \  |     |   \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_

After padding each row (to achieve a constant line length), zipping (transposing rows and columns) and removing the linefeeds, this string has to be encoded:

   /  /  /   \    \   /  /   \    \    \         |||         ||| \    \    \ |||         |||_ -__ -_          |  / \_  __  _         |||_ - _ -  |\    \           /  /  /_  \_   \    \         |||_ - _ -         _   _|||_    \    \    \   /  /   \    \   /  /  /           |||         |||   /  /  /   |||         |||_ -__ -_          |  / \_  __  _         |||  -_  -_  /| /           \    \  _ \ _ /  /  /           |||  -_  -_           _ |||   _

We'll replace each substring " |||" with a 0, each substring " " with a 1 and the characters of "/-_\| " with 2 to 7, forming an array of base 8 digits, which can be encoded as a byte string.

Decoding works by reversing the steps from above.

Code

"^ASÓ8¥È÷^K¯¾/^HÕ2^ÄË1jÒÝ^D^Á0îl;)HR§û|^Ê^Þ^ÇÝÅ^ßNlz^TfÑ^Øj>À^à 4#bH\¿^Äî·íì^E^A~(¿ø³(ú´,^È(¡j>è?#'»vçPïju87)×"

265b8b        e# Convert from base 265 to base 8.
[S9*'|3*+S2*] e# Push ["         |||" "  "].
"/-_\| "+     e# Concatenate to push ["         |||" "  " '/' '-' '_' '\' '|' ' '].
f=            e# Select the elements that correspond to the base 8 digits.
s4/           e# Flatten and chop into chunks of length 4 (columns).
56/           e# Chop into two subarrays of 56 columns.
ri            e# Read an integer from STDIN.
=             e# Select the corresponding subarray.
              e# Arrays wrap around, so [A B]0= eq. [A B]2= and [A B]1= eq. [A B]3=.
zN*           e# Zip and join the rows, separating by linefeeds.

Dennis

Posted 2015-07-27T17:57:08.457

Reputation: 196 637

"Alleged readability?" :P – FryAmTheEggman – 2015-07-29T20:17:27.947

4

05AB1E, 179 177 176 bytes

"
 -/\_|"•ÿ%Ò´Åçδ’Üå·Äm…½µƵδø5)ǝ®∊∊Ý®þCĀ₆áÝoþ²ši¤Æ%ßû¤%¦Ï≠θĀ5¾₃ʒŸQ>Šn°η8±8d¸6':…é’b…÷‡ö©«&‡huѦ%λÁZÊJÌ₅ú∞°»ó₄ι«ÓW´×ƒ×ùqiò2D1āwθóÆ˲’
Tι#и∊²ý‚KʒFæΩZºÿÏ";ηiʒæøвøïž‚è°ć½∊•7вèJ2äIè

Try it online.

Explanation:

•ÿ%Ò´Åçδ’Üå·Äm…½µƵδø5)ǝ®∊∊Ý®þCĀ₆áÝoþ²ši¤Æ%ßû¤%¦Ï≠θĀ5¾₃ʒŸQ>Šn°η8±8d¸6':…é’b…÷‡ö©«&‡huѦ%λÁZÊJÌ₅ú∞°»ó₄ι«ÓW´×ƒ×ùqiò2D1āwθóÆ˲’
Tι#и∊²ý‚KʒFæΩZºÿÏ";ηiʒæøвøïž‚è°ć½∊•

is the compressed number:

669530978249988431396781816197276307266403407188962925862194299697873953319419752813246251351417090709766331736351616127424760949905163941809417778114834562736028512279028673309866195447599979612590918985644583407413903825059942009898007791080822453262749380245316127735585410697701790387188175543639634091138422651942833048832372950797322005040161476426127678479662921265139425

Try it online.

converts it to Base-7 as list, so we get the list of digits:

[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,1,1,1,1,5,5,1,1,1,5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,1,1,5,5,5,0,1,1,3,4,1,1,3,4,1,1,1,1,6,1,1,6,4,1,1,6,1,1,6,1,1,1,1,1,3,1,1,1,1,6,1,1,6,1,1,1,1,1,3,4,1,1,1,1,6,1,1,1,1,1,6,0,1,3,1,1,4,3,1,1,4,1,1,1,6,1,1,6,1,4,1,6,1,1,6,2,2,1,1,6,1,1,1,1,1,6,2,2,4,1,1,1,1,3,5,5,4,1,1,1,6,2,2,1,1,1,6,0,3,1,1,1,1,1,1,1,1,4,1,1,6,1,1,6,1,1,4,6,1,1,6,5,5,1,1,1,4,5,5,1,1,6,1,1,1,4,1,1,3,1,1,1,1,4,1,1,6,1,1,1,1,1,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,1,1,1,1,5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,4,1,1,1,1,1,1,1,1,3,1,1,6,1,1,6,1,1,3,6,1,1,6,1,1,1,1,1,3,1,1,1,1,6,1,1,1,3,1,1,4,1,5,5,1,3,1,1,6,1,1,1,1,1,6,0,1,4,1,1,3,4,1,1,3,1,1,1,6,1,1,6,1,3,1,6,1,1,6,2,2,1,1,6,1,1,1,1,1,6,2,2,3,1,1,1,1,4,1,1,3,1,1,1,6,2,2,1,1,1,6,0,1,1,4,3,1,1,4,3,1,1,1,1,6,1,1,6,3,1,1,6,1,1,6,5,5,1,1,1,4,5,5,1,1,6,5,5,6,1,1,1,1,1,4,3,1,1,1,1,6,5,5,1,1,5,6,5]

Try it online.

è indexes each digit in the string "\n-/\_|", and J then joins the entire list together, which gives us the following:

                       __    __   __             __  ___
  /\  /\    |  |\  |  |     /    |  |     /\    |     |
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   |
/        \  |  |  \|  |__   \__  |   \  /    \  |     |                       __    __                        
\        /  |  |  /|  |     /    |   /  \ __ /  |     |
 \  /\  /   |  | / |  |--  |     |--/    \  /   |--   |
  \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_

Try it online.

splits the string into two parts.
take the input, and indexes it (with automatic wrap-around) to get one of the two parts, which is then being output implicitly.

Huge thanks to @MagicOctopusUrn's ASCII compressor which was used to generate the compressed number and Base-7 transliteral. Try it online. (After which the transliterate has been golfed by reversing the string and number on the stack, using в instead of B to make it a list of digits, and index into the string with è.

Kevin Cruijssen

Posted 2015-07-27T17:57:08.457

Reputation: 67 575

4

Racket, 443 434 386 Bytes

(require file/gunzip net/base64)(define(f n)(define o(open-output-bytes))(gunzip-through-ports(open-input-bytes(base64-decode #"H4sIAK8Lt1UAA22Q3Q3AIAiE352CBcwtRHLpHg7f8lubahRUDuVD5DjItrH9REgOEWgskfVMDeca1GWcSmN2WFBtlUTdzdmSOT0BpEpGnjxUAf2RmvPq1OyKGF6N5V1nvgYcWjeod/Hj8JotBRtH0qM48OeoWrBxJH23KL/dOMh4IDXe8MUbT1AqtKkBAAA="))o)(list-ref(string-split(get-output-string o)"a")(modulo n 2)))

Just for kicks.

(require file/gunzip net/base64)
(define (f n)
  (define o (open-output-bytes))
  (gunzip-through-ports
   (open-input-bytes
    (base64-decode #"H4sIAK8Lt1UAA22Q3Q3AIAiE352CBcwtRHLpHg7f8lubahRUDuVD5DjItrH9REgOEWgskfVMDeca1GWcSmN2WFBtlUTdzdmSOT0BpEpGnjxUAf2RmvPq1OyKGF6N5V1nvgYcWjeod/Hj8JotBRtH0qM48OeoWrBxJH23KL/dOMh4IDXe8MUbT1AqtKkBAAA="))
   o)
  (list-ref (string-split (get-output-string o) "a") (modulo n 2)))

N.B. you may need the #lang racket line to run in DrRacket.

Winny

Posted 2015-07-27T17:57:08.457

Reputation: 1 120

1Exactly 100 bytes off. – user253751 – 2015-07-28T04:39:00.803

1Come on! I know you can also make it to 343 – Optimizer – 2015-07-28T06:45:07.290

I don't see that happening unless I abandon this approach. – Winny – 2015-07-28T06:54:14.953

You dont need to use base 64 characters.You can use just the raw unicode characters that gunzip sends out – MilkyWay90 – 2018-12-02T15:05:24.870

3

Perl, 292 259 246 bytes

$_="Svv __SS__S nnSv nnSnnn
i kjSkj hw|j h|wS /SwrhSi pq hwS |
 mSlmSlS |S| l |S|--wS |--lSSmnnlS |--S |
k ihSih jw|h j|S|__S g__S|oosjSk ih jS|ooSo|o";s/v/SSSSS/g;s/w/S|S/g;s/S/  /g;<>&1?y"g-s"\\/\\  /\\ ___ |":y"g-s"\\  \\/\\/_ /\\| ";print $_

It takes advantage of the fact that the two strings are mostly similar (e.g. the entire I E and C) and makes the string out of characters that are displayed differently depending on which version is being displayed. e.g m means "a forward slash for the right-way-up string, a backward slash in the upside down one". It does a transliteration substitution to display the correct character. Spaces are also run-length encoded using string substitutions.

multi-line:

$_="Svv __SS__S nnSv nnSnnn
i kjSkj hS|S|j h|S|SS /SS|SrhSi pq hS|SS |
 mSlmSlS |S| l |S|--S|SS |--lSSmnnlS |--S |
k ihSih jS|S|h j|S|__S g__S|oosjSk ih jS|ooSo|o";
s/v/SSSSS/g;
s/w/S|S/g;
s/S/  /g;
<>&1?
    y"g-s"\\/\\  /\\ ___ |"
:
    y"g-s"\\  \\/\\/_ /\\| ";
print $_

Idea:

Since there are only 22 unique columns in the output, it should be possible to store it as 22*4 = 88 characters with a range of 0-17 (all the possible "dual-meaning" characters), along with a 56 character lookup table with one entry in the range of 0-21 per column. In theory this could be encoded with < 100 bytes however it's hard to make this a net win because of the more complicated code to decode it.

samgak

Posted 2015-07-27T17:57:08.457

Reputation: 1 577

2

You can shave a couple of bytes - y/foo/bar/ is a synonym for tr/foo/bar/

– ryanm – 2015-07-28T07:31:32.137

3

C, 251 bytes

k(w){char*f="_-/\\|]^^^\0<&*&)&3&(&&WX&J&*&\0t_&/&3&\0`);35)I5M\0a).@7).8-;./.-\0j()(0(1+4()(*+4+4()(04+",*o=f+4,m[229]="",i=7,c=10,p;for(memset(m,32,228);i;c=*f++^(w%2&i--/2==2)*115)for(p=0;*++o;m[(w%2?4-i/6-p/57:p/57)*57+p%57]=c)p+=*o-37;printf(m);}

This is a function k that receives a parameter and prints the message to stdout.

A more readable version:

k(w)
{
    char*f="\n_-/\\|", // characters to fill in
        *o= " "// for each character, the list of positions to put it in, difference-encoded
        "]%%^^^\0"                  // for '\n' (newline)
        "<&*&)&3&(&&WX&J&*&\0"      // for '_' (underscore)
        "t_&/&3&\0"                 // for '-' (minus)
        "`);35)I5M\0"               // for '/' or '\' (slashes)
        "a).@7).8-;./.-\0"          // for '\' or '/' (slashes)
        "j()(0(1+4()(*+4+4()(04+",  // for '|' (vertical bar)
        m[229]="",  // message to generate
        i, // index of character, running 7...1
        c, // current character to fill in
        p, // where to place the character
        y; // y-coordinate of the character

    memset(m,32,228); // fill the message with spaces
    for(i=7;--i;)
    {
        c=*f++;
        c^=~w%2|i/2^1?0:115; // flip the direction of slashes, if needed
        for(p=0;*++o;)
        {
            p+=*o-37; // jump to next position
            y=p/57; // extract the y-coordinate
            y=w%2?4-i/5-y:y; // flip the y-coordinate, if needed
            m[y*57+p%57]=c; // place the character
        }
    }
    printf(m); // print the message
}

First, it prepares an empty message (filled with spaces). For each character (e.g. | or -), it has a list of positions to place that character in.

For each position, if the upside-down version should be printed, the position is flipped. That is, its vertical coordinate y is replaced by 4-y or 3-y (depending on whether the character is an underscore). Also, the directions of the slashes are flipped - this is performed by a XOR with 115.

This control structure is also used to place the newline characters - it seems more efficient to add 4 more coordinates to the list than to write an explicit loop.


There are a few minor glitches with this system. First of all, the final letter T looks a bit different in the flipped version:

___ 
 |    |
 |    |
 |   _|_

To output it correctly, the code has to place the | characters after the _ characters.

In addition, in order to make sure the control string contains only ASCII characters, I encoded it:

  • It records the differences between the positions instead of the positions themselves - this reduces the range
  • The numbers in the string have 37 added to them, to shift them into the ASCII Range 32...127. I could add a smaller number, but 37 avoids characters like " and \, which have to be escaped inside string literals.
  • Two of the numbers were greater than 127 - for example, the first - character appears at position 137. To account for this, I added an artificial - character at another position (79), which is later overwritten - the character | also appears at position 79.

Another funny thing was that I couldn't use puts to output the string - this would produce an extra trailing newline. So I used printf instead.

Also, the number 57 appears 4 times in the golfed code - the seemingly long-winded expression (w%2?4-i/6-p/57:p/57)*57+p%57 makes it possible to eliminate the variable y, making the code shorter.

anatolyg

Posted 2015-07-27T17:57:08.457

Reputation: 10 719

C seems to be such a "always write this construct with this code" kind of language... This... is... very... um...

+1 ;) – clap – 2015-08-15T04:46:27.070

2

Powershell, 275 253 248 bytes

param($n)$d='8 \83484/7/484302 92984308 92918--118--128||6//0\16116129558| \/ |8 /02083\6/10018/6\302 955776_71 9_7_'
'8\,__,777,/6 /,\6/6\,_8 -- _,88,888,  ,||||||'-split','|%{$d=$d-replace+$i++,$_}
0..3|%{$l=$_;-join$d[(0..55|%{$_*8+$l*2+$n%2})]}

Test script:

$f = {

param($n)$d='8 \83484/7/484302 92984308 92918--118--128||6//0\16116129558| \/ |8 /02083\6/10018/6\302 955776_71 9_7_'
'8\,__,777,/6 /,\6/6\,_8 -- _,88,888,  ,||||||'-split','|%{$d=$d-replace+$i++,$_}
0..3|%{$l=$_;-join$d[(0..55|%{$_*8+$l*2+$n%2})]}

}

&$f 2
&$f 1

Output:

                       __    __   __             __  ___
  /\  /\    |  |\  |  |     /    |  |     /\    |     |
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   |
/        \  |  |  \|  |__   \__  |   \  /    \  |     |
                       __    __
\        /  |  |  /|  |     /    |   /  \ __ /  |     |
 \  /\  /   |  | / |  |--  |     |--/    \  /   |--   |
  \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_

Main ideas

The compression method is extended method of CJam by Dennis♦:

  1. Create a string before compression:
    • chars of the first column of both ASCII arts, then
    • chars of the second column, then
    • chars of the third column and so on...
  2. Compress using 10 consecutive replacements (10 because Powershell can use numbers 0..9 as strings, this makes the decompress algorithm shorter. Replacements found by brute force.)

The script for compression:

$src =
"                       __    __   __             __  ___", # line1, art1
"                       __    __                         ", # line1, art2
"  /\  /\    |  |\  |  |     /    |  |     /\    |     | ", # line2, art1
"\        /  |  |  /|  |     /    |   /  \ __ /  |     | ", # line2, art2
" /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   | ", # line3, art1
" \  /\  /   |  | / |  |--  |     |--/    \  /   |--   | ", # line3, art2
"/        \  |  |  \|  |__   \__  |   \  /    \  |     | ", # line4, art1
"  \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_"  # line4, art2

$z=-join(0..$src[0].Length|%{
    $p=$_
    $src|%{$_[$p]}
})
$z

The before compression string is:

   \  /     /\    /    \  \    /    \/      /\    /    \  \    /    \/     /  \                   ||||||                  ||||||  \    /    \/     /  \   ||||||          ||||||__  --____  --__                    ||    //  \\__    ____    __                  ||||||_   -- __   -- _  | \/ |   /  \                    \  /     /\  /__  \  \__  /    \/     /  \                   ||||||_   -- __   -- _                _      __ ||||||_      _

mazzy

Posted 2015-07-27T17:57:08.457

Reputation: 4 832

The explanation in your answer was probably put more effort into than all my answers combined! +1 – MilkyWay90 – 2018-11-11T23:08:34.563

2

CJAM, 206

The two ascii pictures are base-216 encoded, one byte = 3 characters.

" _\/|-":A;S7*"!D!D"+:B;qi2%{B"h  °°¤8 2 °2,J° °"",4# °³8=Ô° Ó\"# Ó °""\"z °Â89D-D·° z ·!¶"}{B"'    '!J"+"#h °¼88 2 °°  ° °""2/\" °²8=Ô° Óh#L Ó °""  h°°9D-D°,2 h° °"}?]{{i32-__36/A=@6/6%A=@6%A=}/N}/

Test it here

Arnaud

Posted 2015-07-27T17:57:08.457

Reputation: 8 231

1

SAS, 442 bytes

%macro a(b);&b=tranwrd(&b,put(i,1.),repeat('A0'x,i));%mend;%macro b(z);length a b c d$99;if mod(&z,2)then do;a='992__3__';b='\7/1|1|1/|1|4/3|2/1\0__0/1|4|';c='0\1/\1/2|1|0/0|1|--1|4|--/3\1/2|--2|';d='1\/1\/3|1|/1|1|__2\__1|__|4\/3|__1_|_';end;else do;a='992__3__2__65__1___';b='1/\1/\3|1|\1|1|4/3|1|4/\3|4|';c='0/1\/1\2|1|0\0|1|--1|4|--\3/__\2|--2|';d='/7\1|1|1\|1|__2\__1|2\1/3\1|4|';end;do i=0to 9;%a(a)%a(b)%a(c)%a(d)end;put a/b/c/d;%mend;`

Non-golfed:

%macro a(b);
  &b=tranwrd(&b,put(i,1.),repeat('A0'x,i));
%mend;

%macro b(z);
length a b c d$99;
if mod(&z,2)then do;
  a='992__3__';
  b='\7/1|1|1/|1|4/3|2/1\0__0/1|4|';
  c='0\1/\1/2|1|0/0|1|--1|4|--/3\1/2|--2|';
  d='1\/1\/3|1|/1|1|__2\__1|__|4\/3|__1_|_';
end;
else do;
  a='992__3__2__65__1___';
  b='1/\1/\3|1|\1|1|4/3|1|4/\3|4|';
  c='0/1\/1\2|1|0\0|1|--1|4|--\3/__\2|--2|';
  d='/7\1|1|1\|1|__2\__1|2\1/3\1|4|';
end;
do i=0to 9;
  %a(a)
  %a(b)
  %a(c)
  %a(d)
end;
put a/b/c/d;
%mend;

Tests:

data a;
  %b(1)
  %b(2)
  %b(0)
  %b(35)
run;
                       __    __
\        /  |  |  /|  |     /    |   /  \ __ /  |     |
 \  /\  /   |  | / |  |--  |     |--/    \  /   |--   |
  \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_
                       __    __   __             __  ___
  /\  /\    |  |\  |  |     /    |  |     /\    |     |
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   |
/        \  |  |  \|  |__   \__  |   \  /    \  |     |
                       __    __   __             __  ___
  /\  /\    |  |\  |  |     /    |  |     /\    |     |
 /  \/  \   |  | \ |  |--  |     |--\    /__\   |--   |
/        \  |  |  \|  |__   \__  |   \  /    \  |     |
                       __    __
\        /  |  |  /|  |     /    |   /  \ __ /  |     |
 \  /\  /   |  | / |  |--  |     |--/    \  /   |--   |
  \/  \/    |  |/  |  |__   \__  |__|     \/    |__  _|_

Could possibly save a bit of code by putting them in input blocks, but that adds the restriction that the macro can only be once per datastep which I feel violates the spirit of writing it as a macro. (And I suspect adding a prompt to get input in the datastep adds more characters).

Joe

Posted 2015-07-27T17:57:08.457

Reputation: 283

1

bash, 247 bytes

(($1%2)) && c=tail || c=head
base64 -d <<<H4sIAF/3uFUCA31Q2w3AIAj8ZwoWMLcQyS3i8JWXtWlTI6BwPA7Vz0Nunc9HhKSowlJU57qWJjBoZ/4a41o8aC4NsTBjbMgYkQDStCIrDz3AbmRuYjpzPTOGG5P9/gmKtQddFy8eMbOn4Khb7NE88ObRs+DgUez3iqrtwYPMAoWJhU/KBeJFPOCqAQAA | zcat | $c -n4

Strings are concatenated and gziped.

Gavin S. Yancey

Posted 2015-07-27T17:57:08.457

Reputation: 617

1

Haskell, 138 bytes

m x=do
 h<-readFile"a"
 return$take 225.drop(225*mod x 2)<$>find((==h).hash.pack)(replicateM 425"/\\|_- ")

This is a bit of a hack. I am bruteforcing the SHA256 hash of the concatination of the two minecraft texts, and then splitting them apart and choosing the appropriate text based on parameter x. This is of cource very impractical and cannot be computed in real time, and there may even be collisions along the way for all I know.

Because Haskell cannot have the ASCII representation of that hash in a string, I am reading it from a file called "a", and has therefor added 32 bytes to my score.

  • readFile and pack is from Data.ByteString.Char8
  • hash is from Crypto.Hash.SHA256

Explaination:

replicateM 425"/\\|_- "

Creates a list of every combination of the letters "/\|_- " on 425 letters (the length of both minecraft texts combined)

find((==h).hash.pack)

Pick the first one that matches the hash

take 225.drop(225*mod x 2)

The first text is 225 letters long, the other one is exactly 200.

BlackCap

Posted 2015-07-27T17:57:08.457

Reputation: 3 576

106 bytes, not 138 – cat – 2016-03-03T22:19:39.507

See my explanation, I added 32 bytes because I am reading a 32 byte long file – BlackCap – 2016-03-04T13:43:14.447

1

Javascript (ES6), 403 296 bytes

(Moved from my previous answer) Trying out a new method:

n=>`55555559Å9Å${n%2?`55555558556776}}5Y75Y¥Æ75786¡YAA[7ćA5Fï5¡YFéA8Y§5}\x83AEÅKÅ\x99}5§5\x999\x95`:`Q5555Q9Ý>6¡77¡}}5Y7756¡75768Y¡AA£7ćA5Fû5u¡FéAY55¡}}­EÅKÅ}G;5¡}5}`}`.replace(r=/./g,x=>(163+x.charCodeAt()).toString(6).slice(1)).replace(r,x=>' /|\\_-'[x]).match(/.{56}/g).join`
`

Note that there is a few unprintable character; these have been replaced with e.g. \x83.

The encoding itself is about 40 bytes shorter than the other, but the decoding process is more elaborate. I used the base-216 system that others have used to encode the text. For reference, here's the code I used:

// normal MINECRAFT
a='00000000000000000000000440000440004400000000000004400444'+
  '00130013000020023002002000001000020020000013000020000020'+
  '01003100300020020302002550020000025530000144300025500020'+
  '100000000300200200320024400034400200030010000300200000200';

// upside-down MINECRAFT
// un-comment this one to run it
/*
a='00000000000000000000000440000440000000000000000000000000'+
  '30000000010020020012002000001000020001003044010020000020'+
  '03001300100020020102002550020000025510000300100025500020'+
  '003100310000200210020024400034400244200000310000244004240';
*/

console.log(a.replace(/.../g,x=>String.fromCharCode(parseInt(b[i],6)+53)));

This basically takes the ASCII text (pre-converted to base 6) and triples it up on itself, changing it to base 216. 53 is then added to remove most non-printable characters.

Suggestions welcome!


Here's the original 403-byte code:

a=n=>{y=[' ','/','|','\\','_','-'],x=`55555559Å9Å${n%2?`55555555¡55Y}}eA5;5};GÝY}5}¡k;77;} 757Ĉ5G;7ć75§H5AB77Ý8ÝEÑ5H5EÅÕ`:`Q5555Q9Ý6¡k5}\u008FAA5;5}}5k5}5}Y§G77G} 757Ċ5?×7ć7;55GAAI7Ý8ÝA865GA5A`}`;b=x.split('').map(x=>x.charCodeAt(0)-53);for(c=[],i=b.length;i--;){c[i]=b[i].toString(6);while(c[i].length<3)c[i]='0'+c[i]}d=c.join('').replace(/\d/g,x=>y[x]).split('');d[56]=d[112]=d[168]=`
`;return d.join('')};

Using a for loop, a while loop, four variables that were only used once, and a ton of long algorithms for simple things. Boy, have I improved...

ETHproductions

Posted 2015-07-27T17:57:08.457

Reputation: 47 880

You can probably completely remove y=[' ','/','|','\\','_','-'], and instead of y[x] write ' /|\\_-'[x]. =) – user42589 – 2015-08-21T21:14:32.230

@Xufox I've done that and a whole lot more, golfing 107 bytes in total! – ETHproductions – 2016-11-15T19:53:29.853

1

PHP, 225 bytes

Ugly, brute-force solution.

echo str_split(gzinflate(base64_decode('dZDdDcAgCITfnYIFzC1Ecos4fOW3Nm2NgsohfIp8DrJtbB8RkkMEGktk7anhXIO6jFNpzA4Lqq2SqLs5WzKnJ4BUycjOQzXQhdScd6dmV8Rwa7rqP9/QukE9ixeGt2wpODASHoWBN0a1ggMj4fuHsuyBQcYDqfH/XrwA')),224)[$argv[1]%2];

I compressed then base64 encoded the concatenated strings to be displayed. The code decodes, decompresses and splits it in pieces of 224 characters. The first string is 224 characters without a trailing newline, the second is 201 characters (also no newline after it). The parity of the command line argument ($argv[1]%2) is used as index in the array generated by str_split().

axiac

Posted 2015-07-27T17:57:08.457

Reputation: 749

0

PHP, 263 bytes

<?=strtr('3333 20220'.['2 0332 020_
2/\2/\211\113/2113/\212 1
 /2\/2\ 11 \ |1412 14\22/0\ 14 1
/32 \112\|102 \012 \2/22\12 1',
'
\32 /112/|13/212 /2\ 0 /12 1
 \2/\2/ 11 / |1412 14/22\2/ 14 1
2\/2\/211/1102 \010|3\/2102_|_'][$argn&1],[__,"  |","  ","     ","--"]);

Try it online!

Jörg Hülsermann

Posted 2015-07-27T17:57:08.457

Reputation: 13 026

You can save eight more bytes with an own replacement for 3 spaces. – Titus – 2018-10-14T02:35:50.987

0

Ruby, 290 bytes

$><<(gets.to_i%2<1?"xCeCdCnCcC_
c/Bc/Be|ABAAf/e|Af/Be|f|
b/cB/cBd|AbBb|A--Af|--Be/CBd|--d|
/iBAAcB|ACdBCAdBc/eBAf|":"xCeC
Bi/AAc/|Af/e|d/cBbCb/Af|
bBc/Bc/d|Ab/b|A--Af|--/eBc/d|--d|
cB/cB/e|A/AACdBCAC|fB/e|Cc_|_").gsub(?C,'__').tr(?B,?\\).gsub(?A,'c|').gsub(/[a-z]/){|e|' '*(e.ord-97)}

Probably a weak and improvable entry. Basically a very simple (handcrafted) compression where lowercase letters mean that many spaces (actually ord(ch) - 'A' spaces) and uppercase letters are just some common terms that saved a few bytes.

Peter Lenkefi

Posted 2015-07-27T17:57:08.457

Reputation: 1 577

0

SOGL V0.12, 72 71 bytes

═j;ΗD^⌡⁾yō⁶⅜┐≡¼τ~≡š┘,┼◄‚4øDqψ∫‛²′Ζdκ↓±ģ░○∙ΘΝ◄ōΞ06║⁶╗i-η}┌^JY³‘''n.2%?№↕

Try it Here!

SOGLs vertical mirroring worked perfectly for this.

dzaima

Posted 2015-07-27T17:57:08.457

Reputation: 19 048

0

Canvas, 70 bytes

C<aT[≤^5t‽◂6Zr!v↓[u0F∙OF-╫#t┬a*7ZfK1!&)y@½(+M⇵PV-¼G:Uju╋╷(╫:N‟‾)n⁸2%?↕

Try it here!

dzaima

Posted 2015-07-27T17:57:08.457

Reputation: 19 048

0

Python, 312 bytes

def y(b):
 x=int(['4vwhclv10tuk4z18gf73aimn6zvwkrhxekphfn1lxocj9ezchd1cd1cv97p3f6k12s8hcjznnm5iq3om4vgxvugp3makgu4n3f6qxvdrtl4c0lva12hwt','8uzwdylhtrf6oqnwnck8pfxu25m5844tuo2700v3zoeuvossx1b47rnwyrmqodau3feu3spi9jydhyxvntv48vojx9iq9af78wufzn1'][b%2],36);x<<=69;s="";t=" /\\-|_\n"
 while x:s+=t[x&7];x>>=3
 print s

Function prints output given an int

Blue

Posted 2015-07-27T17:57:08.457

Reputation: 26 661

Yeah, I'm just looking at a neat way of compressing it down further then that though – Blue – 2015-07-28T09:19:03.327

How does this work? – Oliver Ni – 2015-07-31T17:53:35.090

Is is base-36? but if it is whats 16598125653940296495007405984048067937906981182427207589486265398555496561913976121109917896233762115477615438181875147062369253802653987802486539858466848179256705775331854915993645 – Oliver Ni – 2015-07-31T17:53:54.060

Basically, it stores the two results in a list and then gets the correct one using the modulus function. It then decodes it from base 36 as you thought. Because it was a big power of 2, I removed some chars by doing >>69. I then use a basic translation function to turn it into the correct output. – Blue – 2015-08-03T10:13:17.277

0

C, 321 bytes

Encoded the repetition and the character index into a string.

main(n,v,p,c)char**v,*p,*c;{c=" _/\\|-\n";for(p=atoi(v[1])%2?"8@8iXivs8rhththrthtPrXt`rhspiprhtPtvpshrshr`thtprpthtmhtPtmrXshr`tm`tvhsrhsrXthtrhthti`sihtitPsrXtihqtq":"8@8iXi`i8PihavhrshrsXthtshthtPrXthtPrsXtPtvprhsrhs`thtpspthtmhtPtmsXris`tm`tvr8shththsthti`siht`shrXshtPtw";*p;p++)for(n=*p/8^15;n--;)putchar(c[*p&7]);}

Cole Cameron

Posted 2015-07-27T17:57:08.457

Reputation: 1 013

0

Python 3, 486 533 612

r=str.replace;m,p=r(r(r('''YYYYY   __YA AYY   A___
  /\  /\YX\  X Y/YX Y/\Y| Y|
 /  \/  \   X \ X--  | Y|--\Y/__\   |--   |
/YY\  X  \XA \A|   \  /Y\  | Y| ''','X','|  |'),'Y','    '),'A','__  '),print;
if int(input())%2==0:p(m)
else:
 q,i,u=m.split('\n')[::-1],0,[[23,24,29,30],[42,43],[],[23,24,29,30,34,35,53,49,50,55]];q.insert(0,q.pop())
 while i<len(q):
  x=list(r(q[i],'_',' '))+[' ']
  for a in u[i]:x[a]='_'
  p(r(r(r(r(''.join(x),'___',''),"\\",'t'),'/',"\\"),'t','/'))
  i+=1

Oliver Ni

Posted 2015-07-27T17:57:08.457

Reputation: 9 650