Hexagony, 6 bytes, 17 cycles
s;i>x@
Now the letters six are in more natural order, and the program finishes one cycle faster.
How it works
For more thorough explanation, see the previous answer below.
A B
C > D
E .
Execution path: ABC>CBAD>ADB.>.CE
^^ ^^ ^^ ^
s; i; x; @
Hexagony , 6 bytes, 18 cycles
x>i;s@
Inspired by boboquack's 9-byte solution. The following quote was a big hint:
I'm slightly disappointed that I couldn't get
sixto work (that would be pushing it with three characters, one output, one redirection and one termination).
How it works (or, How I got to this solution)
A 6-byte program is laid out on a hexagon of side length 2, and the 7th instruction is necessarily a no-op:
? ?
? ? ?
? .
Since I needed at least one mirror, I tried out various mirrors placed at various places, until I found this:
A >
B C D
E .
Assuming the current memory is always positive (and there are no branches/mirrors/IP changers among ABCDE), the IP follows the path
A>ADCB>.CAD>DAC.BE
The cell C is run exactly three times, and the cells right before C are D, B, and A respectively. And the cell E is first run after three runs of C. This is exactly what we want: write one of s, i, or x on the memory and print it, and then terminate!
Now back to the actual source code:
x >
i ; s
@ .
And the execution path, linearized, with significant instructions emphasized:
x>xs;i>.;xs>sx;.i@
^^^ ^ ^^ ^
^^ Print 's'
^ ^ Print 'i'
^^ Print 'x'
^ Terminate
Hexagony, 6 bytes
x>i;s@
Inspired by boboquack's 9-byte solution. The following quote was a big hint:
I'm slightly disappointed that I couldn't get
sixto work (that would be pushing it with three characters, one output, one redirection and one termination).
How it works (or, How I got to this solution)
A 6-byte program is laid out on a hexagon of side length 2, and the 7th instruction is necessarily a no-op:
? ?
? ? ?
? .
Since I needed at least one mirror, I tried out various mirrors placed at various places, until I found this:
A >
B C D
E .
Assuming the current memory is always positive (and there are no branches/mirrors/IP changers among ABCDE), the IP follows the path
A>ADCB>.CAD>DAC.BE
The cell C is run exactly three times, and the cells right before C are D, B, and A respectively. And the cell E is first run after three runs of C. This is exactly what we want: write one of s, i, or x on the memory and print it, and then terminate!
Now back to the actual source code:
x >
i ; s
@ .
And the execution path, linearized, with significant instructions emphasized:
x>xs;i>.;xs>sx;.i@
^^^ ^ ^^ ^
^^ Print 's'
^ ^ Print 'i'
^^ Print 'x'
^ Terminate
Hexagony, 6 bytes, 17 cycles
s;i>x@
Now the letters six are in more natural order, and the program finishes one cycle faster.
How it works
For more thorough explanation, see the previous answer below.
A B
C > D
E .
Execution path: ABC>CBAD>ADB.>.CE
^^ ^^ ^^ ^
s; i; x; @
Hexagony , 6 bytes, 18 cycles
x>i;s@
Inspired by boboquack's 9-byte solution. The following quote was a big hint:
I'm slightly disappointed that I couldn't get
sixto work (that would be pushing it with three characters, one output, one redirection and one termination).
How it works (or, How I got to this solution)
A 6-byte program is laid out on a hexagon of side length 2, and the 7th instruction is necessarily a no-op:
? ?
? ? ?
? .
Since I needed at least one mirror, I tried out various mirrors placed at various places, until I found this:
A >
B C D
E .
Assuming the current memory is always positive (and there are no branches/mirrors/IP changers among ABCDE), the IP follows the path
A>ADCB>.CAD>DAC.BE
The cell C is run exactly three times, and the cells right before C are D, B, and A respectively. And the cell E is first run after three runs of C. This is exactly what we want: write one of s, i, or x on the memory and print it, and then terminate!
Now back to the actual source code:
x >
i ; s
@ .
And the execution path, linearized, with significant instructions emphasized:
x>xs;i>.;xs>sx;.i@
^^^ ^ ^^ ^
^^ Print 's'
^ ^ Print 'i'
^^ Print 'x'
^ Terminate
Hexagony, 6 bytes
x>i;s@
Inspired by boboquack's 9-byte solution. The following quote was a big hint:
I'm slightly disappointed that I couldn't get
sixto work (that would be pushing it with three characters, one output, one redirection and one termination).
How it works (or, How I got to this solution)
A 6-byte program is laid out on a hexagon of side length 2, and the 7th instruction is necessarily a no-op:
? ?
? ? ?
? .
Since I needed at least one mirror, I tried out various mirrors placed at various places, until I found this:
A >
B C D
E .
Assuming the current memory is always positive (and there are no branches/mirrors/IP changers among ABCDE), the IP follows the path
A>ADCB>.CAD>DAC.BE
The cell C is run exactly three times, and the cells right before C are D, B, and A respectively. And the cell E is first run after three runs of C. This is exactly what we want: write one of s, i, or x on the memory and print it, and then terminate!
Now back to the actual source code:
x >
i ; s
@ .
And the execution path, linearized, with significant instructions emphasized:
x>xs;i>.;xs>sx;.i@
^^^ ^ ^^ ^
^^ Print 's'
^ ^ Print 'i'
^^ Print 'x'
^ Terminate