Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#Whitespace , 109 bytes

Whitespace , 109 bytes

[S S S T S S T N
_Push_9][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][N
S S S N
_Create_Label_INNER_LOOP][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S T N
_If_0_Jump_to_Label_DONE_INNER_LOOP][S T S S T N
_Copy_0-based_1st][S N
T _Swap_top_two][N
S N
S N
_Jump_to_Label_INNER_LOOP][N
S S T N
_Create_Label_DONE_INNER_LOOP][S N
N
_Discard_top][S N
S _Duplicate_top][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S S S N
_If_0_Jump_to_Label_DONE_LOOP][N
S N
N
_Jump_to_Label_LOOP][N
S S S S N
_Create_Label_DONE_LOOP][S N
N
_Discard_top][N
S S S T N
_Create_Label_PRINT_LOOP][T N
S T _Print_top_as_integer][N
S N
S T N
_Jump_to_Label_PRINT_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Push n=9
Start LOOP:
 Duplicate top (Integer i = n)
 Start INNER_LOOP
 i = i - 1
 if(i == 0):
 Jump to DONE_INNER_LOOP
 Copy n (0-based index 1)
 Swap
 Go to next iteration of INNER_LOOP
 DONE_INNER_LOOP:
 Discard i
 n = n - 1
 if(n == 0):
 Jump to DONE_LOOP
 Go to next iteration of LOOP
DONE_LOOP:
 Discard n
 Start PRINT_LOOP:
 Print top as integer
 Go to next iteration of PRINT_LOOP

Funny thing is, is that outputting with the additional single leading 0 as the challenge in the Sandbox initially had, this could have been 11 bytes shorter: try it online. xD

#Whitespace , 109 bytes

[S S S T S S T N
_Push_9][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][N
S S S N
_Create_Label_INNER_LOOP][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S T N
_If_0_Jump_to_Label_DONE_INNER_LOOP][S T S S T N
_Copy_0-based_1st][S N
T _Swap_top_two][N
S N
S N
_Jump_to_Label_INNER_LOOP][N
S S T N
_Create_Label_DONE_INNER_LOOP][S N
N
_Discard_top][S N
S _Duplicate_top][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S S S N
_If_0_Jump_to_Label_DONE_LOOP][N
S N
N
_Jump_to_Label_LOOP][N
S S S S N
_Create_Label_DONE_LOOP][S N
N
_Discard_top][N
S S S T N
_Create_Label_PRINT_LOOP][T N
S T _Print_top_as_integer][N
S N
S T N
_Jump_to_Label_PRINT_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Push n=9
Start LOOP:
 Duplicate top (Integer i = n)
 Start INNER_LOOP
 i = i - 1
 if(i == 0):
 Jump to DONE_INNER_LOOP
 Copy n (0-based index 1)
 Swap
 Go to next iteration of INNER_LOOP
 DONE_INNER_LOOP:
 Discard i
 n = n - 1
 if(n == 0):
 Jump to DONE_LOOP
 Go to next iteration of LOOP
DONE_LOOP:
 Discard n
 Start PRINT_LOOP:
 Print top as integer
 Go to next iteration of PRINT_LOOP

Funny thing is, is that outputting with the additional single leading 0 as the challenge in the Sandbox initially had, this could have been 11 bytes shorter: try it online. xD

Whitespace , 109 bytes

[S S S T S S T N
_Push_9][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][N
S S S N
_Create_Label_INNER_LOOP][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S T N
_If_0_Jump_to_Label_DONE_INNER_LOOP][S T S S T N
_Copy_0-based_1st][S N
T _Swap_top_two][N
S N
S N
_Jump_to_Label_INNER_LOOP][N
S S T N
_Create_Label_DONE_INNER_LOOP][S N
N
_Discard_top][S N
S _Duplicate_top][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S S S N
_If_0_Jump_to_Label_DONE_LOOP][N
S N
N
_Jump_to_Label_LOOP][N
S S S S N
_Create_Label_DONE_LOOP][S N
N
_Discard_top][N
S S S T N
_Create_Label_PRINT_LOOP][T N
S T _Print_top_as_integer][N
S N
S T N
_Jump_to_Label_PRINT_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Push n=9
Start LOOP:
 Duplicate top (Integer i = n)
 Start INNER_LOOP
 i = i - 1
 if(i == 0):
 Jump to DONE_INNER_LOOP
 Copy n (0-based index 1)
 Swap
 Go to next iteration of INNER_LOOP
 DONE_INNER_LOOP:
 Discard i
 n = n - 1
 if(n == 0):
 Jump to DONE_LOOP
 Go to next iteration of LOOP
DONE_LOOP:
 Discard n
 Start PRINT_LOOP:
 Print top as integer
 Go to next iteration of PRINT_LOOP

Funny thing is, is that outputting with the additional single leading 0 as the challenge in the Sandbox initially had, this could have been 11 bytes shorter: try it online. xD

deleted 1 character in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#Whitespace, 109 bytes

[S S S T S S T N
_Push_9][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][N
S S S N
_Create_Label_INNER_LOOP][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S T N
_If_0_Jump_to_Label_DONE_INNER_LOOP][S T S S T N
_Copy_0-based_1st][S N
T _Swap_top_two][N
S N
S N
_Jump_to_Label_INNER_LOOP][N
S S T N
_Create_Label_DONE_INNER_LOOP][S N
N
_Discard_top][S N
S _Duplicate_top][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S S S N
_If_0_Jump_to_Label_DONE_LOOP][N
S N
N
_Jump_to_Label_LOOP][N
S S S S N
_Create_Label_DONE_LOOP][S N
N
_Discard_top][N
S S S T N
_Create_Label_PRINT_LOOP][T N
S T _Print_top_as_integer][N
S N
S T N
_Jump_to_Label_PRINT_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Push n=9
Start LOOP:
 Duplicate top (Integer i = n)
 Start INNER_LOOP
 i = i - 1
 if(i == 0):
 Jump to DONE_INNER_LOOP
 Copy n (0-based index 1)
 Swap
 Go to next iteration of INNER_LOOP
 DONE_INNER_LOOP:
 Discard i
 n = n - 1
 if(n == 0):
 Jump to DONE_LOOP
 Go to next iteration of LOOP
DONE_LOOP:
 Discard n
 Start PRINT_LOOP:
 Print top as integer
 Go to next iteration of PRINT_LOOP

Funny thing is, is that outputting with the additional single leading 0 as the challenge in the Sandbox initially had, this could have been 911 bytes shorter: try it online try it online. xD

#Whitespace, 109 bytes

[S S S T S S T N
_Push_9][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][N
S S S N
_Create_Label_INNER_LOOP][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S T N
_If_0_Jump_to_Label_DONE_INNER_LOOP][S T S S T N
_Copy_0-based_1st][S N
T _Swap_top_two][N
S N
S N
_Jump_to_Label_INNER_LOOP][N
S S T N
_Create_Label_DONE_INNER_LOOP][S N
N
_Discard_top][S N
S _Duplicate_top][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S S S N
_If_0_Jump_to_Label_DONE_LOOP][N
S N
N
_Jump_to_Label_LOOP][N
S S S S N
_Create_Label_DONE_LOOP][S N
N
_Discard_top][N
S S S T N
_Create_Label_PRINT_LOOP][T N
S T _Print_top_as_integer][N
S N
S T N
_Jump_to_Label_PRINT_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Push n=9
Start LOOP:
 Duplicate top (Integer i = n)
 Start INNER_LOOP
 i = i - 1
 if(i == 0):
 Jump to DONE_INNER_LOOP
 Copy n (0-based index 1)
 Swap
 Go to next iteration of INNER_LOOP
 DONE_INNER_LOOP:
 Discard i
 n = n - 1
 if(n == 0):
 Jump to DONE_LOOP
 Go to next iteration of LOOP
DONE_LOOP:
 Discard n
 Start PRINT_LOOP:
 Print top as integer
 Go to next iteration of PRINT_LOOP

Funny thing is, is that outputting with the additional single leading 0 as the challenge in the Sandbox initially had, this could have been 9 bytes shorter: try it online. xD

#Whitespace, 109 bytes

[S S S T S S T N
_Push_9][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][N
S S S N
_Create_Label_INNER_LOOP][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S T N
_If_0_Jump_to_Label_DONE_INNER_LOOP][S T S S T N
_Copy_0-based_1st][S N
T _Swap_top_two][N
S N
S N
_Jump_to_Label_INNER_LOOP][N
S S T N
_Create_Label_DONE_INNER_LOOP][S N
N
_Discard_top][S N
S _Duplicate_top][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S S S N
_If_0_Jump_to_Label_DONE_LOOP][N
S N
N
_Jump_to_Label_LOOP][N
S S S S N
_Create_Label_DONE_LOOP][S N
N
_Discard_top][N
S S S T N
_Create_Label_PRINT_LOOP][T N
S T _Print_top_as_integer][N
S N
S T N
_Jump_to_Label_PRINT_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Push n=9
Start LOOP:
 Duplicate top (Integer i = n)
 Start INNER_LOOP
 i = i - 1
 if(i == 0):
 Jump to DONE_INNER_LOOP
 Copy n (0-based index 1)
 Swap
 Go to next iteration of INNER_LOOP
 DONE_INNER_LOOP:
 Discard i
 n = n - 1
 if(n == 0):
 Jump to DONE_LOOP
 Go to next iteration of LOOP
DONE_LOOP:
 Discard n
 Start PRINT_LOOP:
 Print top as integer
 Go to next iteration of PRINT_LOOP

Funny thing is, is that outputting with the additional single leading 0 as the challenge in the Sandbox initially had, this could have been 11 bytes shorter: try it online. xD

Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#Whitespace, 109 bytes

[S S S T S S T N
_Push_9][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][N
S S S N
_Create_Label_INNER_LOOP][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S T N
_If_0_Jump_to_Label_DONE_INNER_LOOP][S T S S T N
_Copy_0-based_1st][S N
T _Swap_top_two][N
S N
S N
_Jump_to_Label_INNER_LOOP][N
S S T N
_Create_Label_DONE_INNER_LOOP][S N
N
_Discard_top][S N
S _Duplicate_top][S S S T N
_Push_1][T S S T _Subtract][S N
S _Duplicate_top][N
T S S S N
_If_0_Jump_to_Label_DONE_LOOP][N
S N
N
_Jump_to_Label_LOOP][N
S S S S N
_Create_Label_DONE_LOOP][S N
N
_Discard_top][N
S S S T N
_Create_Label_PRINT_LOOP][T N
S T _Print_top_as_integer][N
S N
S T N
_Jump_to_Label_PRINT_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Push n=9
Start LOOP:
 Duplicate top (Integer i = n)
 Start INNER_LOOP
 i = i - 1
 if(i == 0):
 Jump to DONE_INNER_LOOP
 Copy n (0-based index 1)
 Swap
 Go to next iteration of INNER_LOOP
 DONE_INNER_LOOP:
 Discard i
 n = n - 1
 if(n == 0):
 Jump to DONE_LOOP
 Go to next iteration of LOOP
DONE_LOOP:
 Discard n
 Start PRINT_LOOP:
 Print top as integer
 Go to next iteration of PRINT_LOOP

Funny thing is, is that outputting with the additional single leading 0 as the challenge in the Sandbox initially had, this could have been 9 bytes shorter: try it online. xD

AltStyle によって変換されたページ (->オリジナル) /