Build ASCII ladders
Ruby, 71
->m,n{h=0;(?o+?+*(n-1)+?o).chars{|c|puts [?|+' '*m+?|]*h,c+?-*m+c;h=m}}
ungolfed in test program
f=->m,n{
h=0 #The number of | above the 1st rung is 0
(?o+?+*(n-1)+?o).chars{|c| #Make a string of all the rung ends o++...++o and iterate through it
puts [?|+' '*m+?|]*h, #draw h vertical segments | ... |
c+?-*m+c #and a rung with the correct ends
h=m #The number of | above all rungs except the 1st is m
}
}
f[gets.to_i,gets.to_i]
CJam, 43 42 bytes
I'm not sastified by the score. But I'm not Dennis, right?
q~:Z;'-'o{[\Z*1$N]}:X~['-_'+X\'|XZ*]@*1>1$
Input is 2 space separated items. Length first
2 3
o---o
| |
| |
| |
+---+
| |
| |
| |
o---o
Explanation
q~:Z;'-'o{[\Z*1$N]}:X~['-_'+X\'|XZ*]@*1>1$
q~ e# read input
:Z; e# Record the size in Z and discard
'-'o{[\Z*1$N]}:X~ e# Create the initial line (and final). also creates a shorcut to do this later
\ e# Capture two arguments
Z* e# The separator is repeated size times
1$ e# Repeat the first argument
N e# Add newline
e# X is a function to create line in a ladder
['-_'+X\'|XZ*] e# Design the repeating part
@* e# Repeat the pattern n times
1> e# Discard the initial
1$ e# Since the final line is same than the initial, we just write it.
e# Implicit printing
JavaScript (ES6), 89
... repeat, repeat, repeat ...
(n,m,R=x=>x.repeat(m),b=R(`|${R(' ')}|
`),d=`o${c=R('-')}o
`)=>d+R(b+`+${c}+
`,m=n-1)+b+d
Test
F=(n,m,R=x=>x.repeat(m),b=R(`|${R(' ')}|
`),d=`o${c=R('-')}o
`)=>d+R(b+`+${c}+
`,m=n-1)+b+d
// Less golfed
U=(n,m)=>
{
var R=x=>x.repeat(m),
a=R(' '),
b=R(`|${a}|\n`);
c=R('-'),
d=`o${c}o\n`;
m=n-1;
return d+R(b+`+${c}+\n`)+b+d
}
function test() {
var i=I.value.match(/\d+/g)
if (i) O.textContent=F(+i[0],+i[1])
console.log(i,I.value)
}
test()
N,M: <input id=I value="3,5" oninput=test()>
<pre id=O></pre>