Skip to main content
Catching stack underflow is indeed cheaper than checking empty input
Source Link
Philippos
  • 2.7k
  • 1
  • 12
  • 39

Morsecco: 217 217  216 bytes, score 0

.  -- . -- .  . . .-- . . . - .-. -.- .- -.-. ... .  -.- - ---  -.-. ... 
-- - -.-. - -.- .- . .-..... .- --.. ..
. .---. .- --.. --.
- .- . -........-..-- -- --.. --.
. -.--.--- -- --- --. ..
. -..-
-.- - . - .-- - - .-.. --.. --. - .- --.

The first line remains the same just installing an error handler to silently exit on the end of input to avoid testing for more bytes, but then we need to loop over the string, cutting one byte each time and translating it, because by now morsecco has no substitution command.

Morsecco: 217 bytes, score 0

. . . - .-. -.- .- -.-. ... .  -.- - ---  -.-. ...
-- - -.-. - -.- .- . .-..... .- --.. ..
. .---. .- --.. --.
- .- . -........-..-- -- --.. --.
. -.--.--- -- --- --. ..
. -..-
-.- - . - .-- - - .-.. --.. --. - .- --.

The first line remains the same, but then we need to loop over the string, cutting one byte each time and translating it, because by now morsecco has no substitution command.

Morsecco:  217  216 bytes, score 0

.  -- . -- .  . . .-- . . . - .-. -.- .- -.-. ... .  -.- - ---  -.-. ... 
-- - -.-. - -.- .- . .-..... .- --.. ..
. .---. .- --.. --.
- .- . -........-..-- -- --.. --.
. -.--.--- -- --- --. ..
. -..-
-.- - . - .-- --.

The first line remains the same just installing an error handler to silently exit on the end of input to avoid testing for more bytes, but then we need to loop over the string, cutting one byte each time and translating it, because by now morsecco has no substitution command.

Added zero-score solution
Source Link
Philippos
  • 2.7k
  • 1
  • 12
  • 39

Morsecco: 54 bytes, score 3

Being a three-symbol language, a meta-cat automatically reaches a score of 3:

> echo Test | morsecco '. . . - .-. -.- .- -.-. ... .  -.- - ---  -.-. ... ---'
.  -.-.-.. --..-.- ---..-- ---.-.. -.-.  -.- - ---
> morsecco '.  -.-.-.. --..-.- ---..-- ---.-.. -.-.  -.- - ---'
Test
  • . . Enters an Enter command
  • . - .-. Reads from stdin (special address T)
  • -.- .- Konverts from ·Text
  • -.-. ... Concatenates the dot and the converted input with two spaces for multi-token input
  • . -.- - --- is the multi-token input for the later Konvert to Text and Output
  • -.-. ... Concatenates this to the existing code
  • --- Output the code

Morsecco: 217 bytes, score 0

IndeedYes, we can also do a zero-score version would be possible, because morsecco accepts alternatives for it's characters:

  • TAB can be used instead of whitespace
  • a long dash (unicode 0x2013) can be used as dash
  • the middle dot · (unicode 0x00B7) can replace the dot

But with no substitution commands right nowOf course, this replacement will be really hard ..adds a lot of bytes:

. . . - .-. -.- .- -.-. ... .  -.- - ---  -.-. ...
-- - -.-. - -.- .- . .-..... .- --.. ..
. .---. .- --.. --.
- .- . -........-..-- -- --.. --.
. -.--.--- -- --- --. ..
. -..-
-.- - . - .-- - - .-.. --.. --. - .- --.

The first line remains the same, but then we need to loop over the string, cutting one byte each time and translating it, because by now morsecco has no substitution command.

Morsecco: 54 bytes, score 3

Being a three-symbol language, a meta-cat automatically reaches a score of 3:

> echo Test | morsecco '. . . - .-. -.- .- -.-. ... .  -.- - ---  -.-. ... ---'
.  -.-.-.. --..-.- ---..-- ---.-.. -.-.  -.- - ---
> morsecco '.  -.-.-.. --..-.- ---..-- ---.-.. -.-.  -.- - ---'
Test
  • . . Enters an Enter command
  • . - .-. Reads from stdin (special address T)
  • -.- .- Konverts from ·Text
  • -.-. ... Concatenates the dot and the converted input with two spaces for multi-token input
  • . -.- - --- is the multi-token input for the later Konvert to Text and Output
  • -.-. ... Concatenates this to the existing code
  • --- Output the code

Indeed a zero-score version would be possible, because morsecco accepts alternatives for it's characters:

  • TAB can be used instead of whitespace
  • a long dash (unicode 0x2013) can be used as dash
  • the middle dot · (unicode 0x00B7) can replace the dot

But with no substitution commands right now, this replacement will be really hard ...

Morsecco: 54 bytes, score 3

Being a three-symbol language, a meta-cat automatically reaches a score of 3:

> echo Test | morsecco '. . . - .-. -.- .- -.-. ... .  -.- - ---  -.-. ... ---'
.  -.-.-.. --..-.- ---..-- ---.-.. -.-.  -.- - ---
> morsecco '.  -.-.-.. --..-.- ---..-- ---.-.. -.-.  -.- - ---'
Test
  • . . Enters an Enter command
  • . - .-. Reads from stdin (special address T)
  • -.- .- Konverts from ·Text
  • -.-. ... Concatenates the dot and the converted input with two spaces for multi-token input
  • . -.- - --- is the multi-token input for the later Konvert to Text and Output
  • -.-. ... Concatenates this to the existing code
  • --- Output the code

Morsecco: 217 bytes, score 0

Yes, we can also do a zero-score version, because morsecco accepts alternatives for it's characters:

  • TAB can be used instead of whitespace
  • a long dash (unicode 0x2013) can be used as dash
  • the middle dot · (unicode 0x00B7) can replace the dot

Of course, this adds a lot of bytes:

. . . - .-. -.- .- -.-. ... .  -.- - ---  -.-. ...
-- - -.-. - -.- .- . .-..... .- --.. ..
. .---. .- --.. --.
- .- . -........-..-- -- --.. --.
. -.--.--- -- --- --. ..
. -..-
-.- - . - .-- - - .-.. --.. --. - .- --.

The first line remains the same, but then we need to loop over the string, cutting one byte each time and translating it, because by now morsecco has no substitution command.

Source Link
Philippos
  • 2.7k
  • 1
  • 12
  • 39

Morsecco: 54 bytes, score 3

Being a three-symbol language, a meta-cat automatically reaches a score of 3:

> echo Test | morsecco '. . . - .-. -.- .- -.-. ... .  -.- - ---  -.-. ... ---'
.  -.-.-.. --..-.- ---..-- ---.-.. -.-.  -.- - ---
> morsecco '.  -.-.-.. --..-.- ---..-- ---.-.. -.-.  -.- - ---'
Test
  • . . Enters an Enter command
  • . - .-. Reads from stdin (special address T)
  • -.- .- Konverts from ·Text
  • -.-. ... Concatenates the dot and the converted input with two spaces for multi-token input
  • . -.- - --- is the multi-token input for the later Konvert to Text and Output
  • -.-. ... Concatenates this to the existing code
  • --- Output the code

Indeed a zero-score version would be possible, because morsecco accepts alternatives for it's characters:

  • TAB can be used instead of whitespace
  • a long dash (unicode 0x2013) can be used as dash
  • the middle dot · (unicode 0x00B7) can replace the dot

But with no substitution commands right now, this replacement will be really hard ...