Skip to main content
More thourough pseudo-code
Source Link
tngreene
  • 111
  • 1
  • 5

Befunge-98Befunge-98*, 19 bytes

&:39*\`'`\j;+39*\`'@\j;+,@;-.@

Because the question said you'll receive a 1-26 or an aA-zZ I assumed this meant the number 26 or the character aA-zZ. Most interprets struggle with entering alt-codes, so it is easier to use & and enter values like 126 for 26 or 9790 for 'a' instead of with ~'Z', as opposed to ~.

Pseudo-code

varint c = get stdin
push the value of `'`27
bool is_number =  27 > c
push the value of `@` (9664)
if 27is_number >== c1
   jump to adding 9664 to c //putting it the ASCII range
   print as ASCII
   end
else
   jump to subtracting 9664 from c //putting it in the numerical range
   print as number
   end

Test it out (on Windows) here!

*This is technically Unefunge-98 because it only uses 1 dimension, but that name might be unfamiliar.

Befunge-98, 19 bytes

&:39*\`'`\j;+,@;-.@

Because the question said you'll receive a 1-26 or an a-z I assumed this meant the number 26 or the character a-z. Most interprets struggle with entering alt-codes, so it is easier to use & and enter values like 1 or 97 for 'a' instead of with ~.

Pseudo-code

var c = get stdin
push the value of `'` (96)
if 27 > c
   jump to adding 96 to c //putting it the ASCII range
   print as ASCII
   end
else
   jump to subtracting 96 from c //putting it in the numerical range
   print as number
   end

Test it out (on Windows) here!

Befunge-98*, 19 bytes

&:39*\`'@\j;+,@;-.@

Because the question said you'll receive a 1-26 or an A-Z I assumed this meant the number 26 or the character A-Z. Most interprets struggle with entering alt-codes, so it is easier to use & and enter values like 26 for 26 or 90 for 'Z', as opposed to ~.

Pseudo-code

int c = get stdin
push the value of 27
bool is_number =  27 > c
push the value of `@` (64)
if is_number == 1
   jump to adding 64 to c //putting it the ASCII range
   print as ASCII
   end
else
   jump to subtracting 64 from c //putting it in the numerical range
   print as number
   end

Test it out (on Windows) here!

*This is technically Unefunge-98 because it only uses 1 dimension, but that name might be unfamiliar.

Post Undeleted by tngreene
Post Deleted by tngreene
added 2 characters in body
Source Link
a spaghetto
  • 11.3k
  • 3
  • 46
  • 82

FungeBefunge-98, 19 bytes

&:39*\`'`\j;+,@;-.@

Because the question said you'll receive a 1-26 or an a-z I assumed this meant the number 26 or the character a-z. Most interprets struggle with entering alt-codes, so it is easier to use & and enter values like 1 or 97 for 'a' instead of with ~.

Pseudo-code

var c = get stdin
push the value of `'` (96)
if 27 > c
   jump to adding 96 to c //putting it the ASCII range
   print as ASCII
   end
else
   jump to subtracting 96 from c //putting it in the numerical range
   print as number
   end

Test it out (on Windows) here!

Funge-98, 19 bytes

&:39*\`'`\j;+,@;-.@

Because the question said you'll receive a 1-26 or an a-z I assumed this meant the number 26 or the character a-z. Most interprets struggle with entering alt-codes, so it is easier to use & and enter values like 1 or 97 for 'a' instead of with ~.

Pseudo-code

var c = get stdin
push the value of `'` (96)
if 27 > c
   jump to adding 96 to c //putting it the ASCII range
   print as ASCII
   end
else
   jump to subtracting 96 from c //putting it in the numerical range
   print as number
   end

Test it out (on Windows) here!

Befunge-98, 19 bytes

&:39*\`'`\j;+,@;-.@

Because the question said you'll receive a 1-26 or an a-z I assumed this meant the number 26 or the character a-z. Most interprets struggle with entering alt-codes, so it is easier to use & and enter values like 1 or 97 for 'a' instead of with ~.

Pseudo-code

var c = get stdin
push the value of `'` (96)
if 27 > c
   jump to adding 96 to c //putting it the ASCII range
   print as ASCII
   end
else
   jump to subtracting 96 from c //putting it in the numerical range
   print as number
   end

Test it out (on Windows) here!

Source Link
tngreene
  • 111
  • 1
  • 5

Funge-98, 19 bytes

&:39*\`'`\j;+,@;-.@

Because the question said you'll receive a 1-26 or an a-z I assumed this meant the number 26 or the character a-z. Most interprets struggle with entering alt-codes, so it is easier to use & and enter values like 1 or 97 for 'a' instead of with ~.

Pseudo-code

var c = get stdin
push the value of `'` (96)
if 27 > c
   jump to adding 96 to c //putting it the ASCII range
   print as ASCII
   end
else
   jump to subtracting 96 from c //putting it in the numerical range
   print as number
   end

Test it out (on Windows) here!