[S S S N
_Push_0][S N
S _Duplicate_0][T N
T T _Read_input_as_integer][T T T _Retrieve_heap_at_0][S N
S _Duplicate][N
S S N
_Create_Label_LOOP][S N
N
_Discard_top][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_input][N
T T T N
_Jump_to_Label_EXIT_if_negative][S S S N
_Push_0][S S T T S T T S S T N
_Push_-89_\n][S S T T T S T S T N
_Push_-53_.][S S S T T S S N
_Push_12_o][S S S T T T T N
_Push_15_r][S S T T T S T S N
_Push_-26_I][S S T T S S S S T T N
_Push_-67_space][S S S T S T S T N
_Push_21_x][S S S T T S S N
_Push_12_o][S S S T S S N
_Push_4_g][S S S T T N
_Push_3_f][S S T T N
_Push_1_b][S S T T S S S S T N
_Push_-33_B][S T S S T T S N
_Copy_6th_space][S S T T T S T S T N
_Push_-53_.][S S T T N
_Push_1_b][S S S T T S N
_Push_6_i][S S T T T T S S N
_Push_-28_G][S T S S T S S N
_Copy_4th_space][S S T T N
_Push_-1_b][S S S T T T T N
_Push_15_r][S S S T T S S N
_Push_12_o][S S S T S T S S N
_Push_20_w][S S T T S T S T N
_Push_-21_N][S T S S T S T N
_Copy_5th_space][S S S T T N
_Push_3_f][S S S T T S S N
_Push_12_o][S S T T S T T N
_Push_-11_X][S T S S T T N
_Copy_3rd_space][S S T T T S T S T N
_Push_-53_.][S S S T S T S T N
_Push_21_x][S S S T T S S N
_Push_12_o][S S T T T T S T N
_Push_-29_F][S T S S T S S N
_Copy_4th_space][S S S T S T T N
_Push_11_n][S S S T S T S S N
_Push_20_w][S S S T T S S N
_Push_12_o][S S S T T T T N
_Push_15_r][S S T T S S S S T N
_Push_-33_B][S T S S T S T N
_Copy_5th_space][S S S T S S N
_Push_4_g][S S S T T S N
_Push_6_i][S T S S T T N
_Copy_3rd_B][S S T T S T T S S T N
_Push_-89_\n][S S T T T S T S T N
_Push_-53_.][S S S T S S T N
_Push_9_l][S N
S _Duplicate_9_l][S S S T T S S N
_Push_12_o][S S T T T T T S N
_Push_-30_E][S T S S T S S T N
_Copy_9th_space][S S S T N
_Push_1_d][S T S S T T N
_Copy_3rd_o][S S S T T T T N
_Push_15_r][S S S T S S T N
_Push_9_l][S S S T S T S S N
_Push_20_w][S S T T T S T T N
_Push_-27_H][S T S S T T S N
_Copy_6th_space][S S T T T S T S T N
_Push_-53_.][S S S T S T N
_Push_5_h][S S S T S N
_Push_2_e][S S S T S S T N
_Push_9_l][S N
S _Duplicate_9_l][S S T T S T S S N
_Push_-20_O][S T S S T T S N
_Copy_6th_space][S S S T S T S S N
_Push_20_w][S S S T T S S N
_Push_12_o][S S S T T T T N
_Push_15_r][S S S T S S T N
_Push_9_l][S S T T T T T T N
_Push_-31_D][S T S S T S T N
_Copy_5th_space][S S T T T S T S T N
_Push_-53_.][S S S T N
_Push_1_d][S S S T S S T N
_Push_9_l][S S S T T T T N
_Push_15_r][S S S T T S S N
_Push_12_o][S S T T T S S N
_Push_-12_W][S T S S T T S N
_Copy_6th_space][S S S T T S S N
_Push_12_o][S S S T S S T N
_Push_9_l][S N
S _Duplicate_9_l][S S S T S N
_Push_2_e][S S T T T S T T N
_Push_-27_H][N
S S S N_Create_Label_PRINTER
][S N
S _Duplicate][N
T S N_Jump_to_Label_LOOP_if_0
][S S S T T S S S T T N_Push_99
][T S S S _Add][T N
S S _Print_as_character][N
S N
S N
_Jump_to_Label_PRINTER]
Letters S
(space), T
(tab), and N
(new-line) added as highlighting only.
[..._some_action]
added as explanation only.
Try it online (containing the raw spaces, tabs and new-lines).
Explanation in pseudo-code:
integer i = input_as_integer
Start LOOP
i = i-1
if i is negative:
EXIT
Call function PRINT
function PRINT
Print "Hello World. Dlrow Olleh. Hwlrod Eoll.\n
Big Brown Fox. Xof Nworb Gib. Bbfgox Iro.\n
"
Go to the next iteration of LOOP
Some things I did to golf it:
SNS
(Duplicate) is used for repeated characters (ll
)
- 99 is subtracted from every ASCII-value, which we'll add in the PRINT function to reduce loads of bytes. In Whitespace an integer/character is formed by using
SS
(Stack Manipulation: Push Number) + S
or T
(Positive or Negative) + some T
/ S
(Binary representation of the number where T=1
and S=0
) + N
. So having lower binary values and adding the 99 in the PRINT
function is shorter than using the large binary values directly.
- Since creating the number for a space is 11 bytes (
SSTTSSSSTTN
), I copied the spaces from the last occurrences to the top of the stack instead. For example, after the first space is created in \n.orI xogfbB
, I then use STSSTTSN
(copy 6th to top) instead to copy the previous space. The largest distant between two spaces is 9, and since STSSTSSTN
(copy 9th to top) is still 2 bytes shorter than SSTTSSSSTTN
(create space) I've done this for all spaces to save bytes.
- I did something similar as with the copying of spaces above for every character that has a distance of 3 or less. This applies to the
B
in Big B
and the o
in od Eo
(Note: The distance between both b
in b. Bb
is also three, but creating the number for b
(SSTTN
) is actually shorter than copying the 3rd value to the top of the stack (STSSTTN
).)
Bbfgox Iro
isn't even a permutation.................... \$\endgroup\$