# Staircase Program

The challenge is simple: given two parameters, x and y, output y staircases with x steps. For example:

f(3,1) - 1 staircase with 3 steps.

    _
_|
_|


f(5,2) - 2 staircases with 5 steps.

        _         _
_|        _|
_|        _|
_|        _|
_|        _|


Make sure you output the staircases just like, this and that there is no extra space between staircases. Note that there is one empty line at the top.

But there's a twist. We are going to use a special kind of scoring called staircase scoring. In staircase scoring, as long as the character code (in the encoding your language uses) of each character is higher than the previous character you don't accumulate any points. You get a 1 point penalty for using a character with a code that is less than or equal to that of the previous character. Lowest score wins.

E.g. (Assume we are using Unicode).

• "abcd" - 0 points (every character is higher than the previous)
• "bbbb" - 3 points (the three last b's are not higher than the first)
• "aBcD" - 2 points (remember that in ASCII lowercase letters have higher values than uppercase letters).
• "™©" - 1 point (in Unicode the TM symbol has a value of 8482, where as the copyright symbol has value of 169.)

You can use the following snippet to check your score, as well as get the Unicode values of different characters, using the "Show Codes" toggle. (Note: This snippet scores using the Javascript UTF-16 encoding. It will break up some complex characters into multiple surrogate characters. If you do not want this, you must score yourself.) :

function showCodes() {
if(!check.checked) return;
var val = program.value;
var c = "";
for(var i = 0;i<val.length;i++) {
c+= val.charCodeAt(i) + " ";
}
codes.textContent = c;
}

function toggle() {
if(!check.checked) codes.textContent = "";
else showCodes();
}

function getScore() {
var val = program.value;
var score = 0;
for(var i = 0;i<val.length-1;i++) {
score += val[i+1] <= val[i];
}
}
<textarea rows=10 cols=40 id="program" oninput="showCodes()"></textarea>
<input type="submit" value="Get Score" onclick="getScore()" /> Show Codes<input type="checkbox" id="check" onchange="toggle()" />
<div id="codes"></div>

## Notes:

• The input values x and y will always be > 0
• @Doᴡɴɢᴏᴀᴛ I doubt that. In all revisions of the Unicode standard, there are less than 4.3 billion characters. Commented Dec 28, 2015 at 5:17
• Headsecks is a particularly good 0 score candidate. I dislike writing Brainfuck code, so I'll leave it to someone else.
– lynn
Commented Dec 28, 2015 at 5:18
• Downvoting because I dislike the scoring system. Commented Dec 28, 2015 at 5:34
• You would have had my upvote if you had restricted this to 1 byte characters, typically ascii. Commented Dec 28, 2015 at 8:10
• As lowest score wins, wouldn't it be clearer to express the scoring examples as + x points rather than - x points? Commented Dec 28, 2015 at 12:32

# CJam, 2 points

"qžɟ̬вխتܯࡗथ੻୾భ൓๟༫ဢᅟቼጢᐿᕽᙦᜥᠺᥳᩗ᭦᰼ᵓṦἫ⁦K≎〉"127f&~


Try it here.

It takes a long ascending UTF-8 string, gets all character values modulo 128, then evaluates it as CJam code. Removing the final ~ reveals the "real" program hiding underneath:

q~_,2m*/W%{~-S_+"_|"?}f%:sWf<Sf+f*N*


Which might not even be a very good golf, but luckily it doesn't matter. ^^

Saved a point thanks to Dennis!

I took up @Mauris' idea. I didn't want to actually do this in brainfuck, so I used bfbasic.

Here is the Basic program:

INPUT A
INPUT B

A=A-2
B=B-2

J=0
DO
I=0
DO
IF I=0 THEN
IF A-J>1 THEN
K=0
DO
PRINT "  ";
K=K+1
LOOP WHILE K<A-J-1
END IF

ELSE
K=0
DO
PRINT "  ";
K=K+1
LOOP WHILE K<A-1

IF J=0 THEN
PRINT " ";
END IF
END IF

IF J=0 THEN
PRINT "_";
ELSE
PRINT "_|";
END IF

I=I+1
LOOP WHILE I<B
PRINT

J=J+1
LOOP WHILE J<A

PRINT


bfbasic was incrementing all my inputs by two for some reason.

I then got this brainfuck code:

>+<+[>[>[-]+<-]>[<+>>>>>>>>>>>[-]<<<<<<<<<+[->,.----------[<+>>++++++[<------>-]>>>>>>>[<<<<<<<+>>>>>>>-]<<<<<<<[>>>>>>>++++++++++<<<<<<<-]<[>>>>>>>>+<<<<<<<<-]]<]>>>>>>>>>>>>[-]<<<<<<<<<<<<+[->,.----------[<+>>++++++[<------>-]>>>>>>>>>>[<<<<<<<<<<+>>>>>>>>>>-]<<<<<<<<<<[>>>>>>>>>>++++++++++<<<<<<<<<<-]<[>>>>>>>>>>>+<<<<<<<<<<<-]]<]>>>>>>>>[-]>[<+<<<<<<<<+>>>>>>>>>-]<<<<<<<<<[>>>>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by using this Python script in conjunction with Multilang's headsecks implementation:

import headsecks

m=0
with open(input()) as p:
c="+-<>.,[]"
h=""

for i in p:
h+=chr(c.index(i)+8*m)
m+=1

with open('h.hs', 'w') as x:
x.write(h)



And ended up with this headsecks program (It works in the snippet):

https://gist.github.com/anonymous/d956240df995f3cd7d86

xxd dump:

https://gist.github.com/anonymous/67e1fed9e53a770bb770

# Python 2, 25 points

Following Mauris' approach of unicode character conversion:

exec ''.join([chr(ord(unicode(c))%256) for c in u'dťɦ̠ѨԨٳܬ࡮ऩ਺ଊఠ൰๲ཀྵၮᅴሠ፮ᐪᔨᘧᜠᠧᤪᨲᬪᱳᴫḧὟ‧℩∊⌠⑦╯♲✠⡫⤠⩩⭮Ⱐ⵲⹡⽮でㅥ㈨㍳㐩㔺㘊㜠㠠㥰㩲㭩㱮㵴㸠㽮䀪䄨䈧䌠䐧䔪䘨䜲䠪䥳䨭䬲䰪䵫中伲倩儫刧卟呼唧嘫圧堠大娪嬨尲崪幫弫怱愩戩'])


Example input and output:

h(5,2)

_          _
_|         _|
_|         _|
_|         _|
_|         _|
_|         _|

h(3,1)

_
_|
_|
_|


# Vyxalj, Score 5

ƛd‛_|↳¹d↲Ṫ⁰*;Ṙ


Try it Online!

Using the Vyxal codepage, score is 5.

# TeaScript, 33 points

r(x)vm#pR(l*2)+"_"+(g=l==a.n-1?p:"|")+(pR(x*2-2)+"_"+g)R(y-1))j(n


This is unusually long because TeaScript 3 is fairly new and contains many bugs, especially with unicode shortcuts which kills the score.

Try it online