MATL, 19 bytes
'|-| '2:"iqWQB]E!+)
###Explanation
Explanation
The approach is similar to that used in this other answer. The code builds a numerical array of the form
3 2 2 2 3
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
3 2 2 2 3
and then its values are used as (1-based, modular) indices into the string '|-| ' to produce the desired result.
'|-| ' % Push this string
2:" ] % Do this twice
i % Take input
q % Subtract 1
W % 2 raised to that
Q % Add 1
B % Convert to binary
E % Multiply by 2
! % Transpose
+ % Add with broadcast
) % Index (modular, 1-based) into the string
MATL, 19 bytes
'|-| '2:"iqWQB]E!+)
###Explanation
The approach is similar to that used in this other answer. The code builds a numerical array of the form
3 2 2 2 3
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
3 2 2 2 3
and then its values are used as (1-based, modular) indices into the string '|-| ' to produce the desired result.
'|-| ' % Push this string
2:" ] % Do this twice
i % Take input
q % Subtract 1
W % 2 raised to that
Q % Add 1
B % Convert to binary
E % Multiply by 2
! % Transpose
+ % Add with broadcast
) % Index (modular, 1-based) into the string
MATL, 19 bytes
'|-| '2:"iqWQB]E!+)
Explanation
The approach is similar to that used in this other answer. The code builds a numerical array of the form
3 2 2 2 3
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
3 2 2 2 3
and then its values are used as (1-based, modular) indices into the string '|-| ' to produce the desired result.
'|-| ' % Push this string
2:" ] % Do this twice
i % Take input
q % Subtract 1
W % 2 raised to that
Q % Add 1
B % Convert to binary
E % Multiply by 2
! % Transpose
+ % Add with broadcast
) % Index (modular, 1-based) into the string
MATL, 19 bytes
'|-| '2:"iqWQB]E!+)
###Explanation
The approach is similar to that used in this other answer this other answer. The code builds a numerical array of the form
3 2 2 2 3
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
3 2 2 2 3
and then its values are used as (1-based, modular) indices into the string '|-| ' to produce the desired result.
'|-| ' % Push this string
2:" ] % Do this twice
i % Take input
q % Subtract 1
W % 2 raised to that
Q % Add 1
B % Convert to binary
E % Multiply by 2
! % Transpose
+ % Add with broadcast
) % Index (modular, 1-based) into the string
MATL, 19 bytes
'|-| '2:"iqWQB]E!+)
###Explanation
The approach is similar to that used in this other answer. The code builds a numerical array of the form
3 2 2 2 3
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
3 2 2 2 3
and then its values are used as (1-based, modular) indices into the string '|-| ' to produce the desired result.
'|-| ' % Push this string
2:" ] % Do this twice
i % Take input
q % Subtract 1
W % 2 raised to that
Q % Add 1
B % Convert to binary
E % Multiply by 2
! % Transpose
+ % Add with broadcast
) % Index (modular, 1-based) into the string
MATL, 19 bytes
'|-| '2:"iqWQB]E!+)
###Explanation
The approach is similar to that used in this other answer. The code builds a numerical array of the form
3 2 2 2 3
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
3 2 2 2 3
and then its values are used as (1-based, modular) indices into the string '|-| ' to produce the desired result.
'|-| ' % Push this string
2:" ] % Do this twice
i % Take input
q % Subtract 1
W % 2 raised to that
Q % Add 1
B % Convert to binary
E % Multiply by 2
! % Transpose
+ % Add with broadcast
) % Index (modular, 1-based) into the string
MATL, 19 bytes
'|-| '2:"iqWQB]E!+)
###Explanation
The approach is similar to that used in this other answer . The code builds a numerical array of the form
3 2 2 2 3
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
3 2 2 2 3
and then its values are used as (1-based, modular) indices into the string '|-| ' to produce the desired result.
'|-| ' % Push this string
2:" ] % Do this twice
i % Take input
q % Subtract 1
W % 2 raised to that
Q % Add 1
B % Convert to binary
E % Multiply by 2
! % Transpose
+ % Add with broadcast
) % Index (modular, 1-based) into the string
MATL, 19 bytes
'|-| '2:"iqWQB]E!+)
###Explanation
The approach is similar to that used in this other answer . The code builds a numerical array of the form
3 2 2 2 3
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
3 2 2 2 3
and then its values are used as (1-based, modular) indices into the string '|-| ' to produce the desired result.
'|-| ' % Push this string
2:" ] % Do this twice
i % Take input
q % Subtract 1
W % 2 raised to that
Q % Add 1
B % Convert to binary
E % Multiply by 2
! % Transpose
+ % Add with broadcast
) % Index (modular, 1-based) into the string