Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

><>, 9 8 bytes

Thanks to Sp3000 for saving a byte.

'i$-%n/

There's an unprintable 0x01 before the /.

Try it online!

Explanation

This is a port of my character code-based Labyrinth answercharacter code-based Labyrinth answer.

'     Push the entire program (except ' itself) onto the stack, which ends 
      with [... 1 47].
i     Read the first character of the input.
$-    Subtract the 47.
%     Take the 1 modulo this value.
n     Output the result as an integer.
0x01  Unknown command, terminates the program.

><>, 9 8 bytes

Thanks to Sp3000 for saving a byte.

'i$-%n/

There's an unprintable 0x01 before the /.

Try it online!

Explanation

This is a port of my character code-based Labyrinth answer.

'     Push the entire program (except ' itself) onto the stack, which ends 
      with [... 1 47].
i     Read the first character of the input.
$-    Subtract the 47.
%     Take the 1 modulo this value.
n     Output the result as an integer.
0x01  Unknown command, terminates the program.

><>, 9 8 bytes

Thanks to Sp3000 for saving a byte.

'i$-%n/

There's an unprintable 0x01 before the /.

Try it online!

Explanation

This is a port of my character code-based Labyrinth answer.

'     Push the entire program (except ' itself) onto the stack, which ends 
      with [... 1 47].
i     Read the first character of the input.
$-    Subtract the 47.
%     Take the 1 modulo this value.
n     Output the result as an integer.
0x01  Unknown command, terminates the program.
added 131 characters in body
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

><>, 9 bytes

><>, 9 8 bytes

Thanks to Sp3000 for saving a byte.

1i"/"'i$-%n;%n/

Try it online! There's an unprintable 0x01 before the /.

ATry it online!

Explanation

This is a port of my character code-based Labyrinth answer.

'     Push the entire program (except ' itself) onto the stack, which ends 
      with [... 1 47].
i     Read the first character of the input.
$-    Subtract the 47.
%     Take the 1 modulo this value.
n     Output the result as an integer.
0x01  Unknown command, terminates the program.

><>, 9 bytes

1i"/"-%n;

Try it online!

A port of my character code-based Labyrinth answer.

><>, 9 8 bytes

Thanks to Sp3000 for saving a byte.

'i$-%n/

There's an unprintable 0x01 before the /.

Try it online!

Explanation

This is a port of my character code-based Labyrinth answer.

'     Push the entire program (except ' itself) onto the stack, which ends 
      with [... 1 47].
i     Read the first character of the input.
$-    Subtract the 47.
%     Take the 1 modulo this value.
n     Output the result as an integer.
0x01  Unknown command, terminates the program.
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

><>, 9 bytes

1i"/"-%n;

Try it online!

A port of my character code-based Labyrinth answer.