Trilangle, (削除) 14 (削除ここまで) 8 bytes
<>i,@##o
Try it on the online interpreter!
The interpreter loads this into a triangular grid and adds trailing .s as necessary. When expanded, this program becomes:
<
> i
, @ #
# o . .
The IP starts on the north corner headed southwest.
Starting on the red path, the interpreter hits the following instructions:
<: Redirect the IP left, where it wraps around to the right side of the next rowi: Read a single character from input>: Branch
When it hits the branch instruction, the IP changes direction depending on the sign of the character read. EOF is -1 and all other characters are positive, so it branches on EOF.
When it reads EOF, it continues on the green path, and quickly hits @, terminating the program. Otherwise, it continues on the blue path:
o: Output a character\: Change the direction of program flow,: Pop from the stack#: Skip the next instruction (twice)
After this, it reaches the <, where it merges with the red path.
The , instruction is necessary to keep memory bounded when fed an infinite input stream (e.g. when piping yes into it).
Trilangle, (削除) 14 (削除ここまで) 8 bytes
<>i,@##o
Try it on the online interpreter!
The interpreter loads this into a triangular grid and adds trailing .s as necessary. When expanded, this program becomes:
<
> i
, @ #
# o . .
The IP starts on the north corner headed southwest.
Starting on the red path, the interpreter hits the following instructions:
<: Redirect the IP left, where it wraps around to the right side of the next rowi: Read a single character from input>: Branch
When it hits the branch instruction, the IP changes direction depending on the sign of the character read. EOF is -1 and all other characters are positive, so it branches on EOF.
When it reads EOF, it continues on the green path, and quickly hits @, terminating the program. Otherwise, it continues on the blue path:
o: Output a character\: Change the direction of program flow,: Pop from the stack#: Skip the next instruction (twice)
After this, it reaches the <, where it merges with the red path.
The , instruction is necessary to keep memory bounded when fed an infinite input stream (e.g. when piping yes into it).
Trilangle, (削除) 14 (削除ここまで) 8 bytes
<>i,@##o
Try it on the online interpreter!
The interpreter loads this into a triangular grid and adds trailing .s as necessary. When expanded, this program becomes:
<
> i
, @ #
# o . .
The IP starts on the north corner headed southwest.
Starting on the red path, the interpreter hits the following instructions:
<: Redirect the IP left, where it wraps around to the right side of the next rowi: Read a single character from input>: Branch
When it hits the branch instruction, the IP changes direction depending on the sign of the character read. EOF is -1 and all other characters are positive, so it branches on EOF.
When it reads EOF, it continues on the green path, and quickly hits @, terminating the program. Otherwise, it continues on the blue path:
o: Output a character,: Pop from the stack#: Skip the next instruction (twice)
After this, it reaches the <, where it merges with the red path.
The , instruction is necessary to keep memory bounded when fed an infinite input stream (e.g. when piping yes into it).
Trilangle, 14(削除) 14 (削除ここまで) 8 bytes
#@..L\vio.._\<>i,@##o
Try it on the online interpreter the online interpreter!
The interpreter loads this into a triangular grid and adds trailing .s as necessary. When expanded, this program becomes:
#<
@> .i
., L@ \#
v i# o .
. _ \ , .
The IP starts on the north corner headed southwest.
Starting on the red path, the interpreter hits the following instructions:
#<: SkipRedirect the next character.: No-opvIP left,_: Changewhere it wraps around to the directionright side of program flowthe next rowi: Read a single character from inputL>: Branch
When it hits the branch instruction, the IP changes direction depending on the sign of the character read. EOF is -1 and all other characters are positive, so it branches on EOF.
When it reads EOF, it continues on the green path, and immediatelyquickly hits @, terminating the program. Otherwise, it continues on the blue path:
\: Change the direction of program flowo: Output a character\: Change the direction of program flow,: Pop from the stack.#: No-opSkip the next instruction (twice)
After this, it runs off the edge of the board, wrapping around toreaches the v<, where it merges with the red path.
The , instruction is necessary to keep memory bounded when fed an infinite input stream (e.g. when piping yes into it). If this is not necessary, the , can be removed for 13 bytes.
Other 14-byte solutions
Mostly the same as above, just change the location of the , and \.
#@..L\vio.._,\
This one cannot be reduced to 13 bytes by removing the ,:
#@..L\vio,._.\
Trilangle, 14 bytes
#@..L\vio.._\,
Try it on the online interpreter!
The interpreter loads this into a triangular grid and adds trailing .s as necessary. When expanded, this program becomes:
#
@ .
. L \
v i o .
. _ \ , .
The IP starts on the north corner headed southwest.
Starting on the red path, the interpreter hits the following instructions:
#: Skip the next character.: No-opv,_: Change the direction of program flowi: Read a single character from inputL: Branch
When it hits the branch instruction, the IP changes direction depending on the sign of the character read. EOF is -1 and all other characters are positive, so it branches on EOF.
When it reads EOF, it continues on the green path, and immediately hits @, terminating the program. Otherwise, it continues on the blue path:
\: Change the direction of program flowo: Output a character\: Change the direction of program flow,: Pop from the stack.: No-op
After this, it runs off the edge of the board, wrapping around to the v, where it merges with the red path.
The , instruction is necessary to keep memory bounded when fed an infinite input stream (e.g. when piping yes into it). If this is not necessary, the , can be removed for 13 bytes.
Other 14-byte solutions
Mostly the same as above, just change the location of the , and \.
#@..L\vio.._,\
This one cannot be reduced to 13 bytes by removing the ,:
#@..L\vio,._.\
Trilangle, (削除) 14 (削除ここまで) 8 bytes
<>i,@##o
Try it on the online interpreter!
The interpreter loads this into a triangular grid and adds trailing .s as necessary. When expanded, this program becomes:
<
> i
, @ #
# o . .
The IP starts on the north corner headed southwest.
Starting on the red path, the interpreter hits the following instructions:
<: Redirect the IP left, where it wraps around to the right side of the next rowi: Read a single character from input>: Branch
When it hits the branch instruction, the IP changes direction depending on the sign of the character read. EOF is -1 and all other characters are positive, so it branches on EOF.
When it reads EOF, it continues on the green path, and quickly hits @, terminating the program. Otherwise, it continues on the blue path:
o: Output a character\: Change the direction of program flow,: Pop from the stack#: Skip the next instruction (twice)
After this, it reaches the <, where it merges with the red path.
The , instruction is necessary to keep memory bounded when fed an infinite input stream (e.g. when piping yes into it).
Trilangle, 14 bytes
#@..L\vio.._,円
Try it on the online interpreter !
The interpreter loads this into a triangular grid and adds trailing .s as necessary. When expanded, this program becomes:
#
@ .
. L \
v i o .
. _ \ , .
The IP starts on the north corner headed southwest.
Starting on the red path, the interpreter hits the following instructions:
#: Skip the next character.: No-opv,_: Change the direction of program flowi: Read a single character from inputL: Branch
When it hits the branch instruction, the IP changes direction depending on the sign of the character read. EOF is -1 and all other characters are positive, so it branches on EOF.
When it reads EOF, it continues on the green path, and immediately hits @, terminating the program. Otherwise, it continues on the blue path:
\: Change the direction of program flowo: Output a character\: Change the direction of program flow,: Pop from the stack.: No-op
After this, it runs off the edge of the board, wrapping around to the v, where it merges with the red path.
The , instruction is necessary to keep memory bounded when fed an infinite input stream (e.g. when piping yes into it). If this is not necessary, the , can be removed for 13 bytes.
Other 14-byte solutions
Mostly the same as above, just change the location of the , and \.
#@..L\vio.._,\
This one cannot be reduced to 13 bytes by removing the ,:
#@..L\vio,._.\
Trilangle, 14 bytes
#@..L\vio.._,円
The interpreter loads this into a triangular grid and adds trailing .s as necessary. When expanded, this program becomes:
#
@ .
. L \
v i o .
. _ \ , .
The IP starts on the north corner headed southwest.
Starting on the red path, the interpreter hits the following instructions:
#: Skip the next character.: No-opv,_: Change the direction of program flowi: Read a single character from inputL: Branch
When it hits the branch instruction, the IP changes direction depending on the sign of the character read. EOF is -1 and all other characters are positive, so it branches on EOF.
When it reads EOF, it continues on the green path, and immediately hits @, terminating the program. Otherwise, it continues on the blue path:
\: Change the direction of program flowo: Output a character\: Change the direction of program flow,: Pop from the stack.: No-op
After this, it runs off the edge of the board, wrapping around to the v, where it merges with the red path.
The , instruction is necessary to keep memory bounded when fed an infinite input stream (e.g. when piping yes into it). If this is not necessary, the , can be removed for 13 bytes.
Other 14-byte solutions
Mostly the same as above, just change the location of the , and \.
#@..L\vio.._,\
This one cannot be reduced to 13 bytes by removing the ,:
#@..L\vio,._.\
Trilangle, 14 bytes
#@..L\vio.._,円
Try it on the online interpreter !
The interpreter loads this into a triangular grid and adds trailing .s as necessary. When expanded, this program becomes:
#
@ .
. L \
v i o .
. _ \ , .
The IP starts on the north corner headed southwest.
Starting on the red path, the interpreter hits the following instructions:
#: Skip the next character.: No-opv,_: Change the direction of program flowi: Read a single character from inputL: Branch
When it hits the branch instruction, the IP changes direction depending on the sign of the character read. EOF is -1 and all other characters are positive, so it branches on EOF.
When it reads EOF, it continues on the green path, and immediately hits @, terminating the program. Otherwise, it continues on the blue path:
\: Change the direction of program flowo: Output a character\: Change the direction of program flow,: Pop from the stack.: No-op
After this, it runs off the edge of the board, wrapping around to the v, where it merges with the red path.
The , instruction is necessary to keep memory bounded when fed an infinite input stream (e.g. when piping yes into it). If this is not necessary, the , can be removed for 13 bytes.
Other 14-byte solutions
Mostly the same as above, just change the location of the , and \.
#@..L\vio.._,\
This one cannot be reduced to 13 bytes by removing the ,:
#@..L\vio,._.\