1
\$\begingroup\$

This is similar to a previous question on this site, but with much simpler rules, so we should get much shorter results (in bytes):

  • Input: ASCII art with only two possible characters: space and '#'.
  • Output: Input sequence rotated 90 degrees counter-clockwise.

Winner is answer with least number of bytes including length of language name.

asked Feb 5, 2014 at 21:53
\$\endgroup\$
9
  • 7
    \$\begingroup\$ Any special reason for the "including length of language name"? \$\endgroup\$ Commented Feb 5, 2014 at 21:56
  • 1
    \$\begingroup\$ Are input lines equal length (padded with spaces if necessary)? \$\endgroup\$ Commented Feb 5, 2014 at 22:04
  • 1
    \$\begingroup\$ @nbubis Don't think that this is really such a incentive. \$\endgroup\$ Commented Feb 5, 2014 at 22:10
  • 5
    \$\begingroup\$ Why try to penalise esoteric languages in the first place? If your goal is to encourage other languages, focus on encouraging other languages effectively rather than penalising esoterics ineffectively. StackExchange even has a built-in method to encourage a particular type of answer: the bounty. \$\endgroup\$ Commented Feb 5, 2014 at 23:39
  • 15
    \$\begingroup\$ So, say, JavaScript (a normal, non-esoteric language) has a higher penalty than APL or J or K, and the same penalty as GolfScript? Not sure how that "encourages non esoteric languages" at all... \$\endgroup\$ Commented Feb 6, 2014 at 1:36

11 Answers 11

10
\$\begingroup\$

K, 1+1

+

.

k)+("# # #";" # # ";"#####")
"# #"
" ##"
"# #"
" ##"
"# #"
answered Feb 6, 2014 at 1:04
\$\endgroup\$
2
  • 2
    \$\begingroup\$ I don't know k, but I count k ) + and than the matrix, thats 3 characters right? And than you need to add the K as one character. So the total is 4, not 1 \$\endgroup\$ Commented Jul 4, 2014 at 10:54
  • 7
    \$\begingroup\$ The k) is just a prompt, like >>> in a python interpreter. It doesn't need to be there at all \$\endgroup\$ Commented Jul 4, 2014 at 15:34
4
\$\begingroup\$

GolfScript (10 chars + 10)

n/zip-1%n*

Online demo

Note: as Tomas correctly observed in the comments, I'm assuming that the input is rectangular. This seems reasonable, because it is explicitly stated in the specification of the question which this one aims to simplify.

answered Feb 5, 2014 at 23:33
\$\endgroup\$
1
  • \$\begingroup\$ You are assuming that all the lines are of the same length, which was not specified in the rules. I think you can still post your solution but the limitation should be stated in the asnwer. \$\endgroup\$ Commented Feb 6, 2014 at 11:55
4
\$\begingroup\$

MATLAB - 14

rot90(a)

Where 'a' is the input art, in matrix form. 8 characters in the code, 6 in the name. 8 + 6 = 14.

answered Jul 4, 2014 at 9:53
\$\endgroup\$
0
3
\$\begingroup\$

J, 16+1 characters

|.|:[;._2[1!:1[3

Usage (first 3 lines of # is the input, the rest is the output):

 |.|:[;._2[1!:1[3
# # #
 # # 
#####
# #
 ##
# #
 ##
# #

Explanation:

1!:1[3 take multi-line input from the keyboard
[ used as a separator
[;._2 chop the string into lines
|: transpose
|. reverse

12 characters to take an process the input, and 4 characters to complete the task.

answered Feb 5, 2014 at 22:04
\$\endgroup\$
3
\$\begingroup\$

Python 3.X 56-Chars

print('\n'.join(map(''.join,zip(*input().split('\n')))))

Demo

>>> print '\n'.join(map(''.join,zip(*raw_input().split('\n'))))
# # #
 # # 
#####
# # 
 ## 
# # 
 ## 
# # 
# ## # #
 ## # # 
# ######
 ## 
# # 
answered Feb 6, 2014 at 2:33
\$\endgroup\$
1
  • \$\begingroup\$ A bit late, but aren't you supposed to add 6 chars because "Python" has six letters? \$\endgroup\$ Commented Nov 1, 2016 at 17:18
2
\$\begingroup\$

R, 4+1

t(a)

Where 'a' is the input art, in matrix form. Language is Cran R, function to transform/rotate a martix is t.

answered Jul 4, 2014 at 10:57
\$\endgroup\$
1
  • \$\begingroup\$ The score is 5: 4 + 1 (the length of R) \$\endgroup\$ Commented Sep 13, 2016 at 21:12
1
\$\begingroup\$

Ruby 56

s=[*$<];s[0].size.downto(1){|i|puts s.map{|l|l[i-1]}*''}
answered Feb 5, 2014 at 22:45
\$\endgroup\$
2
  • \$\begingroup\$ I think there's a syntax error somewhere. \$\endgroup\$ Commented Feb 5, 2014 at 23:58
  • \$\begingroup\$ @nbubis All lines must be of the same length (padded with spaces). Also an updated version of Ruby is probably required. \$\endgroup\$ Commented Feb 6, 2014 at 0:03
1
\$\begingroup\$

Perl, 44 chars

$/=$i--;$_=<>;say/(.).{$i}$/gmwhile!++$i||1ドル

Assuming all rows have equal length.

answered Feb 6, 2014 at 15:09
\$\endgroup\$
1
\$\begingroup\$

J (4+1)

|:|.

Expected input as a string matrix. Usage:

 a=: >'# # #';' # #';'#####'
 a
# # #
 # # 
#####
 |:|.a
# #
## 
# #
## 
# #
answered Jul 7, 2014 at 7:11
\$\endgroup\$
1
1
\$\begingroup\$

Bash (削除) (144 + 4) (削除ここまで) (131 + 4)

Assumes input is in a file with newlines to delimit end of row.
Assumes each row has the same number of characters.
Assumes first argument is path to file.

t=`sed 's/\(.\)/1円\t/g' 1ドル` n=$(expr $(head -n1 1ドル|wc -c) \- 1);for i in $(seq 1 $n);do echo "$t"|cut -f$i|tac|tr -d '\n';echo;done

Un-golfed:

t=$(sed 's/\(.\)/1円\t/g' 1ドル) # Add a tab after every character.
n=$(expr $(head -n 1 1ドル | wc -c) \- 1) # Count the number of characters in a row.
for i in $(seq 1 $n); do # For each row.
 echo "$t"|cut -f "$i" |tac|tr -d '\n' # Cut the i^th column, print, reverse and delete newline.
 echo # Finished processing i^th row. Emit newline.
done
answered Jun 27, 2016 at 19:00
\$\endgroup\$
0
\$\begingroup\$

JavaScript (ES6), 83

f=(s,o=[],a='')=>/./.test(s)?f(s.replace(/^./gm,x=>(a=x+a)&&''),[...o,a]):o.join`\n`
G.onclick=g=>X.innerHTML=f(X.innerHTML)
textarea{
 height:100px;
 line-height:7px;
}
<button id=G>Rotate</button>
<textarea id=X>
# 
# # 
# # 
# # 
# # 
# #
# # 
# # 
# # 
# # 
# 
</textarea>

answered Jun 27, 2016 at 23:04
\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.