Skip to main content
shortened
Source Link

Python 2 - 286285

import sys l=list(sys.stdin) L=len;R=range r=L(l)-2 c=L(max(l,key=L))-2 k=r+c+1 d=int(l[-1])/90%4 a=d/2;x=a^d%2 z=1-x*2;t=1-a*2 m=[k*[' ']for i in R(k)] for i in R(r+1): for j in R(L(l[i])-1):m[a*c+x*r+z*i+t*j][r-a*r+x*c-t*i+z*j]=' \/'[ord(l[i][j])/4%7^d%2]40^d%2] for s in m:print''.join(s) 

I strongly suspect it can be golfed more, tips are welcome.

Examples:

% python r45.py <<< "|| _____ 45" / \ / \ \ \ \ % python r45.py <<< " _ | |_ |___| -45" / \ / \ / / \ / \ 

If the 2nd one looks misaligned, that's because of some issues with the question:
First, the underscore is at the bottom of the character "cell", while the pipe, slash and backslash are all in the middle. It would be fairer to use a dash (-) instead of underscore.
Second, with the rotation of the heart in the question, you couldn't represent it in any reasonable way if the first line was ___ (3 underscores) instead of  _, as the 1st and 3rd underscore would be "capping" the pipes in the 2nd line.

Here's a better heart:

% python r45.py <<< " _ | | | _ | | ___ -45" / \ / \ \ / \ / \ / 

Python 2 - 286

import sys l=list(sys.stdin) L=len;R=range r=L(l)-2 c=L(max(l,key=L))-2 k=r+c+1 d=int(l[-1])/90%4 a=d/2;x=a^d%2 z=1-x*2;t=1-a*2 m=[k*[' ']for i in R(k)] for i in R(r+1): for j in R(L(l[i])-1):m[a*c+x*r+z*i+t*j][r-a*r+x*c-t*i+z*j]=' \/'[ord(l[i][j])/4%7^d%2] for s in m:print''.join(s) 

I strongly suspect it can be golfed more, tips are welcome.

Examples:

% python r45.py <<< "|| _____ 45" / \ / \ \ \ \ % python r45.py <<< " _ | |_ |___| -45" / \ / \ / / \ / \ 

If the 2nd one looks misaligned, that's because of some issues with the question:
First, the underscore is at the bottom of the character "cell", while the pipe, slash and backslash are all in the middle. It would be fairer to use a dash (-) instead of underscore.
Second, with the rotation of the heart in the question, you couldn't represent it in any reasonable way if the first line was ___ (3 underscores) instead of  _, as the 1st and 3rd underscore would be "capping" the pipes in the 2nd line.

Here's a better heart:

% python r45.py <<< " _ | | | _ | | ___ -45" / \ / \ \ / \ / \ / 

Python 2 - 285

import sys l=list(sys.stdin) L=len;R=range r=L(l)-2 c=L(max(l,key=L))-2 k=r+c+1 d=int(l[-1])/90%4 a=d/2;x=a^d%2 z=1-x*2;t=1-a*2 m=[k*[' ']for i in R(k)] for i in R(r+1): for j in R(L(l[i])-1):m[a*c+x*r+z*i+t*j][r-a*r+x*c-t*i+z*j]=' \/'[ord(l[i][j])/40^d%2] for s in m:print''.join(s) 

I strongly suspect it can be golfed more, tips are welcome.

Examples:

% python r45.py <<< "|| _____ 45" / \ / \ \ \ \ % python r45.py <<< " _ | |_ |___| -45" / \ / \ / / \ / \ 

If the 2nd one looks misaligned, that's because of some issues with the question:
First, the underscore is at the bottom of the character "cell", while the pipe, slash and backslash are all in the middle. It would be fairer to use a dash (-) instead of underscore.
Second, with the rotation of the heart in the question, you couldn't represent it in any reasonable way if the first line was ___ (3 underscores) instead of  _, as the 1st and 3rd underscore would be "capping" the pipes in the 2nd line.

Here's a better heart:

% python r45.py <<< " _ | | | _ | | ___ -45" / \ / \ \ / \ / \ / 
shortened
Source Link

Python 2 - 288286

import sys l=list(sys.stdin) L=len;R=range r=L(l)-2 c=L(max(l,key=L))-2 k=r+c+1 d=int(l[-1])/90%4 a=d/2;b=d%2;x=a^b2;x=a^d%2 z=1-x*2;t=1-a*2 m=[k*[' ']for i in R(k)] for i in R(r+1): for j in R(L(l[i])-1):m[a*c+x*r+z*i+t*j][r-a*r+x*c-t*i+z*j]=' \/'[ord(l[i][j])/4%7^b]4%7^d%2] for s in m:print''.join(s) 

I strongly suspect it can be golfed more, tips are welcome.

Examples:

% python r45.py <<< "|| _____ 45" / \ / \ \ \ \ % python r45.py <<< " _ | |_ |___| -45" / \ / \ / / \ / \ 

If the 2nd one looks misaligned, that's because of some issues with the question:
First, the underscore is at the bottom of the character "cell", while the pipe, slash and backslash are all in the middle. It would be fairer to use a dash (-) instead of underscore.
Second, with the rotation of the heart in the question, you couldn't represent it in any reasonable way if the first line was ___ (3 underscores) instead of  _, as the 1st and 3rd underscore would be "capping" the pipes in the 2nd line.

Here's a better heart:

% python r45.py <<< " _ | | | _ | | ___ -45" / \ / \ \ / \ / \ / 

Python 2 - 288

import sys l=list(sys.stdin) L=len;R=range r=L(l)-2 c=L(max(l,key=L))-2 k=r+c+1 d=int(l[-1])/90%4 a=d/2;b=d%2;x=a^b z=1-x*2;t=1-a*2 m=[k*[' ']for i in R(k)] for i in R(r+1): for j in R(L(l[i])-1):m[a*c+x*r+z*i+t*j][r-a*r+x*c-t*i+z*j]=' \/'[ord(l[i][j])/4%7^b] for s in m:print''.join(s) 

I strongly suspect it can be golfed more, tips are welcome.

Examples:

% python r45.py <<< "|| _____ 45" / \ / \ \ \ \ % python r45.py <<< " _ | |_ |___| -45" / \ / \ / / \ / \ 

If the 2nd one looks misaligned, that's because of some issues with the question:
First, the underscore is at the bottom of the character "cell", while the pipe, slash and backslash are all in the middle. It would be fairer to use a dash (-) instead of underscore.
Second, with the rotation of the heart in the question, you couldn't represent it in any reasonable way if the first line was ___ (3 underscores) instead of  _, as the 1st and 3rd underscore would be "capping" the pipes in the 2nd line.

Here's a better heart:

% python r45.py <<< " _ | | | _ | | ___ -45" / \ / \ \ / \ / \ / 

Python 2 - 286

import sys l=list(sys.stdin) L=len;R=range r=L(l)-2 c=L(max(l,key=L))-2 k=r+c+1 d=int(l[-1])/90%4 a=d/2;x=a^d%2 z=1-x*2;t=1-a*2 m=[k*[' ']for i in R(k)] for i in R(r+1): for j in R(L(l[i])-1):m[a*c+x*r+z*i+t*j][r-a*r+x*c-t*i+z*j]=' \/'[ord(l[i][j])/4%7^d%2] for s in m:print''.join(s) 

I strongly suspect it can be golfed more, tips are welcome.

Examples:

% python r45.py <<< "|| _____ 45" / \ / \ \ \ \ % python r45.py <<< " _ | |_ |___| -45" / \ / \ / / \ / \ 

If the 2nd one looks misaligned, that's because of some issues with the question:
First, the underscore is at the bottom of the character "cell", while the pipe, slash and backslash are all in the middle. It would be fairer to use a dash (-) instead of underscore.
Second, with the rotation of the heart in the question, you couldn't represent it in any reasonable way if the first line was ___ (3 underscores) instead of  _, as the 1st and 3rd underscore would be "capping" the pipes in the 2nd line.

Here's a better heart:

% python r45.py <<< " _ | | | _ | | ___ -45" / \ / \ \ / \ / \ / 
shortened
Source Link

Python 2 - 289288

import sys l=list(sys.stdin) L=len;R=range r=L(l)-2 c=L(max(l,key=L))-2 k=r+c+1 d=int(l[-1])/90%4 a=d/2;b=d%2;x=a^b z=1-x*2;t=1-a*2 m=[k*[' ']for i in R(k)] for i in R(r+1): for j in R(L(l[i])-1):m[a*c+x*r+z*i+t*j][r-a*r+x*c-t*i+z*j]=' \/\\'[ord'[ord(l[i][j])%8/2^b]4%7^b] for s in m:print''.join(s) 

I strongly suspect it can be golfed more, tips are welcome.

Examples:

% python r45.py <<< "|| _____ 45" / \ / \ \ \ \ % python r45.py <<< " _ | |_ |___| -45" / \ / \ / / \ / \ 

If the 2nd one looks misaligned, that's because of some issues with the question:
First, the underscore is at the bottom of the character "cell", while the pipe, slash and backslash are all in the middle. It would be fairer to use a dash (-) instead of underscore.
Second, with the rotation of the heart in the question, you couldn't represent it in any reasonable way if the first line was ___ (3 underscores) instead of  _, as the 1st and 3rd underscore would be "capping" the pipes in the 2nd line.

Here's a better heart:

% python r45.py <<< " _ | | | _ | | ___ -45" / \ / \ \ / \ / \ / 

Python 2 - 289

import sys l=list(sys.stdin) L=len;R=range r=L(l)-2 c=L(max(l,key=L))-2 k=r+c+1 d=int(l[-1])/90%4 a=d/2;b=d%2;x=a^b z=1-x*2;t=1-a*2 m=[k*[' ']for i in R(k)] for i in R(r+1): for j in R(L(l[i])-1):m[a*c+x*r+z*i+t*j][r-a*r+x*c-t*i+z*j]=' /\\'[ord(l[i][j])%8/2^b] for s in m:print''.join(s) 

I strongly suspect it can be golfed more, tips are welcome.

Examples:

% python r45.py <<< "|| _____ 45" / \ / \ \ \ \ % python r45.py <<< " _ | |_ |___| -45" / \ / \ / / \ / \ 

If the 2nd one looks misaligned, that's because of some issues with the question:
First, the underscore is at the bottom of the character "cell", while the pipe, slash and backslash are all in the middle. It would be fairer to use a dash (-) instead of underscore.
Second, with the rotation of the heart in the question, you couldn't represent it in any reasonable way if the first line was ___ (3 underscores) instead of  _, as the 1st and 3rd underscore would be "capping" the pipes in the 2nd line.

Here's a better heart:

% python r45.py <<< " _ | | | _ | | ___ -45" / \ / \ \ / \ / \ / 

Python 2 - 288

import sys l=list(sys.stdin) L=len;R=range r=L(l)-2 c=L(max(l,key=L))-2 k=r+c+1 d=int(l[-1])/90%4 a=d/2;b=d%2;x=a^b z=1-x*2;t=1-a*2 m=[k*[' ']for i in R(k)] for i in R(r+1): for j in R(L(l[i])-1):m[a*c+x*r+z*i+t*j][r-a*r+x*c-t*i+z*j]=' \/'[ord(l[i][j])/4%7^b] for s in m:print''.join(s) 

I strongly suspect it can be golfed more, tips are welcome.

Examples:

% python r45.py <<< "|| _____ 45" / \ / \ \ \ \ % python r45.py <<< " _ | |_ |___| -45" / \ / \ / / \ / \ 

If the 2nd one looks misaligned, that's because of some issues with the question:
First, the underscore is at the bottom of the character "cell", while the pipe, slash and backslash are all in the middle. It would be fairer to use a dash (-) instead of underscore.
Second, with the rotation of the heart in the question, you couldn't represent it in any reasonable way if the first line was ___ (3 underscores) instead of  _, as the 1st and 3rd underscore would be "capping" the pipes in the 2nd line.

Here's a better heart:

% python r45.py <<< " _ | | | _ | | ___ -45" / \ / \ \ / \ / \ / 
shortened
Source Link
Loading
oops, I had dashes in there
Source Link
Loading
shortened
Source Link
Loading
shortened and rearranged
Source Link
Loading
shortened
Source Link
Loading
shortened
Source Link
Loading
shortened
Source Link
Loading
shortened; fixed spaces
Source Link
Loading
shortened
Source Link
Loading
shortened
Source Link
Loading
added 224 characters in body
Source Link
Loading
Source Link
Loading