><> (Fish), 215 183 158156 bytes
99+0{:}1=?.~~" "oo::2,:1%-v -1 oooo "____" v!? )0:/! " /"oa~~.?=1}:{24~/:oo v!?)0:-1o"\"v!?)0:/!-1ooo" /" /v ~o"/"oa/! !\:0)?!;"\__"ooo1-:0)?!;"/"o1- Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack Internal99+0{:}1=?.~~" "oo::2,:1%-v -1 oooo "____" v!? )0:/! " /"oa~~.?=1}:{24~/:oo v!?)0:-1o"\"v!?)0:/!-1ooo" /" /v ~o"/"oa/! !\:0)?!;"\__"ooo1-:0)?!;"/"o1- 99+0{:}1=?.~~" "oo::2,:1%-v -1 oooo "____" v!? )0:/! " /"oa~~.?=1}:{24~/:oo v!?)0:-1o"\"v!?)0:/!-1ooo" /" /v ~o"/"oa/! !\:0)?!;"\__"ooo1-:0)?!;"/"o1- 99+0{:}1=?.~~" "oo:2,:1%-v -1 oooo "____" v!? )0:/! " /"oa~~.?=1}:{24~/:oo v!?)0:-1o"\"v!?)0:/!-1ooo" /" /v ~o"/"oa/! !\:0)?!;"\__"ooo1-:0)?!;"/"o1- Far fromEdit: Notepad++ was giving me 5 extra bytes due to CR, so modified count accordingly
Slightly more golfed, but it is my first fish program so far >_< The requirement to not have a blank first line for 1 triangle doubled the size of the program.
99+0{:}1=?.~~" "oo:1(?;:2,:1%-v -1oooo"____"v!? 1 oooo "____" v!? )0:/! " /"oa~~.?=1}:{2+aa~24~/:oo" /"oa~~oo v!?)0:-1o"\"v!?)0:/!-1ooo" /"v!?)0:" o"/"oa/! v ~o"/ v~"oa/! !\:0)?!;"\__"ooo1-:0)?!;"/"o1-!\:0 Will get around to an explanation soon.Explanation:
Start with initial stack as input number 99+0 Push 18 and 0 to the top of the stack {:} Shift the stack to the left (wraps), copy the top value, and shift it back to the left (i.e. copy bottom of stack to the top) 1= Check to see if the top of the stack is equal to 1, pushes 1 for true, 0 for false ?. If top of stack is zero, skip the ., otherwise jumps to x,y coordinates on top of stack (18,0). This skips the next 8 instructions ~~ Pop the top 2 values from the stack (if they're not popped by the jump) " " Push the string literal " " onto the stack oo Pop the top two values of stack and output them as characters :2, Copy top value of stack, ad divide by 2 :1%- Since ><> uses float division, and doesn't have >= notation, remove the decimal part (if exists) v Redirect pointer down / Redirect pointer left :0) Copy top of stack, and see if its greater than 0 (1 for true, 0 for false) ?!v If top of stack is non-zero, then ! is executed, which skips the next instruction (redirect), otherwise, code is redirected "____" Push the literal "____" to the stack oooo Pop the top four values of stack and output them as characters 1- Decrement the top of the stack by 1 !/ Ignore the redirect action. When the loop gets to 0, it goes to next line, and gets redirected to the left. ~ Pops the top of the stack (0 counter) 42 Pushes 4 and 2 to the stack {:} As before, copies the bottom of the stack to the top 1=?. Also as before, if the initial value is 1, jump to (2,4) (skipping next 4 instructions ~~ Pop 2 values from stack if these instructions haven't been skipped ao Push 10 onto the stack and output it as a character (LF) "/ "oo Push the literal "/ " onto the stack and output it :// Copies the top of the stack then redirects to the line below, which then redirects to the left :0) Copies top of the stack and compares if its greater than 0 ?!v If it is, redirect to next line "\"o Push "\" to stack, then output it as a character 1- Decrement top value of stack :0)?!v If loop is not greater than 0, redirect to next line Either mode of redirect will loop to the left, and (potentially) skip the far right redirect because of the ! ao Push 10 to stack and output it as a character (LF) "/"o~ Push "/" to stack, then output it as a character. Pop top value of stack (the 0 from previous loop) v Redirects to next line, which then redirects to the right :0)?!; If the top of the stack is not greater than 0, terminate (;) "\__" Pushes "\__" to the stack ooo Outputs top 3 stack values as characters ("__\") 1- Decrement top of stack by 1 :0)?!; If the top of the stack is not greater than 0, terminate (;) "/"o Push "/" to top of stack then output it as a character 1- Decrement top of stack by 1 !\ Ignore the redirect Far from golfed, but it is my first fish program so far >_< The requirement to not have a blank first line for 1 triangle doubled the size of the program.
99+0{:}1=?.~~" "oo:1(?;:2,:1%-v -1oooo"____"v!? )0:/! .?=1}:{2+aa~/:oo" /"oa~~ -1o"\"v!?)0:/!-1ooo" /"v!?)0: o"/"oa/! / v~ )?!;"\__"ooo1-:0)?!;"/"o1-!\:0 Will get around to an explanation soon.
Edit: Notepad++ was giving me 5 extra bytes due to CR, so modified count accordingly
Slightly more golfed, but it is my first fish program so far >_< The requirement to not have a blank first line for 1 triangle doubled the size of the program.
99+0{:}1=?.~~" "oo::2,:1%-v -1 oooo "____" v!? )0:/! " /"oa~~.?=1}:{24~/:oo v!?)0:-1o"\"v!?)0:/!-1ooo" /" /v ~o"/"oa/! !\:0)?!;"\__"ooo1-:0)?!;"/"o1- Explanation:
Start with initial stack as input number 99+0 Push 18 and 0 to the top of the stack {:} Shift the stack to the left (wraps), copy the top value, and shift it back to the left (i.e. copy bottom of stack to the top) 1= Check to see if the top of the stack is equal to 1, pushes 1 for true, 0 for false ?. If top of stack is zero, skip the ., otherwise jumps to x,y coordinates on top of stack (18,0). This skips the next 8 instructions ~~ Pop the top 2 values from the stack (if they're not popped by the jump) " " Push the string literal " " onto the stack oo Pop the top two values of stack and output them as characters :2, Copy top value of stack, ad divide by 2 :1%- Since ><> uses float division, and doesn't have >= notation, remove the decimal part (if exists) v Redirect pointer down / Redirect pointer left :0) Copy top of stack, and see if its greater than 0 (1 for true, 0 for false) ?!v If top of stack is non-zero, then ! is executed, which skips the next instruction (redirect), otherwise, code is redirected "____" Push the literal "____" to the stack oooo Pop the top four values of stack and output them as characters 1- Decrement the top of the stack by 1 !/ Ignore the redirect action. When the loop gets to 0, it goes to next line, and gets redirected to the left. ~ Pops the top of the stack (0 counter) 42 Pushes 4 and 2 to the stack {:} As before, copies the bottom of the stack to the top 1=?. Also as before, if the initial value is 1, jump to (2,4) (skipping next 4 instructions ~~ Pop 2 values from stack if these instructions haven't been skipped ao Push 10 onto the stack and output it as a character (LF) "/ "oo Push the literal "/ " onto the stack and output it :// Copies the top of the stack then redirects to the line below, which then redirects to the left :0) Copies top of the stack and compares if its greater than 0 ?!v If it is, redirect to next line "\"o Push "\" to stack, then output it as a character 1- Decrement top value of stack :0)?!v If loop is not greater than 0, redirect to next line Either mode of redirect will loop to the left, and (potentially) skip the far right redirect because of the ! ao Push 10 to stack and output it as a character (LF) "/"o~ Push "/" to stack, then output it as a character. Pop top value of stack (the 0 from previous loop) v Redirects to next line, which then redirects to the right :0)?!; If the top of the stack is not greater than 0, terminate (;) "\__" Pushes "\__" to the stack ooo Outputs top 3 stack values as characters ("__\") 1- Decrement top of stack by 1 :0)?!; If the top of the stack is not greater than 0, terminate (;) "/"o Push "/" to top of stack then output it as a character 1- Decrement top of stack by 1 !\ Ignore the redirect Far from golfed, but it is my first fish program so far >_< The requirement to not have a blank first line for 1 triangle doubled the size of the program.
99+0{:}1=?.~~" "oo:1(?;:2,:1%-ff+3+1{:}1=?.~~" "oovv "____"oooo1- 1oooo"____"v!? !\:0)?!v 0:oo" /" oa ~~! .?=1}:{28~ 2+aa~/:oo" /"oa~~ -1ooo" /"v1o"\"v!?)0:/!-1o"\"v1ooo" /"v!?)0: o"/"oa/! /! v~ o"/"oa/! / /v~ !\:0)?!;"\__"ooo1-:0)?!;"/"o1-!\:0 Can test at http://fishlanguage.com/ (Int on initial stack for length)
Will get around to an explanation soon.
Far from golfed, but it is my first fish program so far >_< The requirement to not have a blank first line for 1 triangle doubled the size of the program.
:1(?;:2,:1%-ff+3+1{:}1=?.~~" "oov "____"oooo1- !\:0)?!v :oo" /" oa ~~.?=1}:{28~ / -1ooo" /"v!?)0:-1o"\"v!?)0: /! v~ o"/"oa/! / !\:0)?!;"\__"ooo1-:0)?!;"/"o1- Can test at http://fishlanguage.com/ (Int on initial stack for length)
Will get around to an explanation soon.
Far from golfed, but it is my first fish program so far >_< The requirement to not have a blank first line for 1 triangle doubled the size of the program.
99+0{:}1=?.~~" "oo:1(?;:2,:1%-v -1oooo"____"v!? )0:/! .?=1}:{2+aa~/:oo" /"oa~~ -1o"\"v!?)0:/!-1ooo" /"v!?)0: o"/"oa/! / v~ )?!;"\__"ooo1-:0)?!;"/"o1-!\:0 Can test at http://fishlanguage.com/ (Int on initial stack for length)
Will get around to an explanation soon.