All in all it's just, uh, another trick in code golf
C, 86 85 83 82 bytes
3 bytes saved thanks to Lynn.
1 byte saved thanks to charlie.
i;f(o,w,h){++w;for(i=0;++i<w*h;)putchar(i%w?i/w%3?i%w+i/w/3*4+~o&7?32:124:95:10);}
C, 92 bytes
b(f,w,h,y,x){for(y=0;y<h;y++,puts(""))for(x=0;x<w;x++)putchar(y%3?(x+y/3*4-f)%8?32:124:95);}
Invoke as b(F, W, H)
.
Pyth, 43 27 bytes
I need to golf it heavily... the score is too shameful.
AQVE<*H?%N3X*8d+G*4/N3\|\_H
Try it online already.
Input format
6,44
11
Output format
____________________________________________
| | | | |
| | | | |
____________________________________________
| | | | | |
| | | | | |
____________________________________________
| | | | |
| | | | |
____________________________________________
| | | | | |
Explanation
AQVE<*H?%N3X*8d+G*4/N3\|\_H First two inputs as list in Q,
third input as E.
AQ Assign G to the first item in Q
and H to the second item in Q.
VE For N from 0 to E-1:
/N3 N floor-div 3.
if N gives a remainder of 3 or 4 or 5
when divided by 6, this will be odd;
otherwise, this will be even.
*4 Multiply by 4.
if the above is odd, this will leave
a remainder of 4 when divided by 8;
otherwise, the remainder would be 0.
+G Add G (as an offset).
X*8d \| In the string " " (*8d),
replace (X) the character with the
index above with "|" (modular indexing,
hence the manipulation above).
?%N3 \_ If N%3 is non-zero, use the above;
otherwise, use "_".
*H The above repeated H times.
< H Take the first H characters of above.
Implicitly print with newline.