Skip to main content
Thutu's now on TIO
Source Link
user62131
user62131

As far as I know, there isn't a Thutu implementation that works in a browser yet. I used the implementation in the Esoteric Files Archive, which is a compiler from Thutu to Perl (basically, compile the Thutu into Perl, then run the Perl). Update: Since I wrote that, the language has been added to TIO. So now you can:

Try it online!

This program prints 24 in Thutu24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng (test here), 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in Vim/V, and 1 in Python 3.

As far as I know, there isn't a Thutu implementation that works in a browser yet. I used the implementation in the Esoteric Files Archive, which is a compiler from Thutu to Perl (basically, compile the Thutu into Perl, then run the Perl).

This program prints 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng (test here), 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in Vim/V, and 1 in Python 3.

As far as I know, there isn't a Thutu implementation that works in a browser yet. I used the implementation in the Esoteric Files Archive, which is a compiler from Thutu to Perl (basically, compile the Thutu into Perl, then run the Perl). Update: Since I wrote that, the language has been added to TIO. So now you can:

Try it online!

This program prints 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng (test here), 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in Vim/V, and 1 in Python 3.

Thutu doesn't do global substitutions
Source Link
user62131
user62131

So how does the Thutu work? Most of the code is a comment, with only one line of code. Thutu's kind-of like Retina; it works by repeatedly regexing a working space. Initially, the input is =1. We first check to see if it matches the regex print(( … ===2| (it does, because most (all)? regexes ending with | will match anything). Then we replace all occurrencesone occurrence of =1 with 24=x=9+. At the end of each cycle, the Thutu implementation will output everything before =x (i.e. 24), exit (due to the presence of =9), and keep the + (which we don't care about) for the next cycle (which doesn't exist).

So how does the Thutu work? Most of the code is a comment, with only one line of code. Thutu's kind-of like Retina; it works by repeatedly regexing a working space. Initially, the input is =1. We first check to see if it matches the regex print(( … ===2| (it does, because most (all)? regexes ending with | will match anything). Then we replace all occurrences of =1 with 24=x=9+. At the end of each cycle, the Thutu implementation will output everything before =x (i.e. 24), exit (due to the presence of =9), and keep the + (which we don't care about) for the next cycle (which doesn't exist).

So how does the Thutu work? Most of the code is a comment, with only one line of code. Thutu's kind-of like Retina; it works by repeatedly regexing a working space. Initially, the input is =1. We first check to see if it matches the regex print(( … ===2| (it does, because most (all)? regexes ending with | will match anything). Then we replace one occurrence of =1 with 24=x=9+. At the end of each cycle, the Thutu implementation will output everything before =x (i.e. 24), exit (due to the presence of =9), and keep the + (which we don't care about) for the next cycle (which doesn't exist).

Source Link
user62131
user62131

24. Thutu, 211 bytes

Fourth try. Hopefully the implementation is uncontroversially valid this time.

#v`16/"<"6/b.q@"(::):::  (22)S#;n4"14"
#>3N6@15o|> ^*ttt*~++~~~%
#=~nJ<R"12";
#[
#|
print((eval("1\x2f2")and 9 or 13)-(0and+4)^1<<65>>62)#@46(8+9+9+9+9+=!)=#print(17)#3]#echo 21#===2|/=1/24=x=9+/
#8␛dggi2␛` |1|6

␛ represents a literal ESC character, as usual.

As far as I know, there isn't a Thutu implementation that works in a browser yet. I used the implementation in the Esoteric Files Archive, which is a compiler from Thutu to Perl (basically, compile the Thutu into Perl, then run the Perl).

This program prints 24 in Thutu, 23 in Hexagony, 22 in Underload, 21 in Nim, 20 in Prelude, 19 in Reng (test here), 18 in Cardinal, 17 in Julia, 16 in Pyth, 15 in Haystack, 14 in Turtlèd, 13 in Ruby, 12 in Fission, 11 in Befunge-98, 10 in Befunge-93, 9 in Perl, 8 in Retina, 7 in Japt, 6 in SMBF, 5 in Python 2, 4 in ><>, 3 in Minkolang, 2 in Vim/V, and 1 in Python 3.

I had to pretty much redo the Hexagony part of the solution. It turns out to be easiest to run the Hexagony code on a diagonal, rather than horizontally:

        # v 1 6 / " < " 6
       / b . q @ " ( : : )
      : : : ( 2 2 ) S # ; n
     4 " 1 4 " # > 3 N 6 @ 1
    5 o | > ^ * t t t * ~ + +
   ~ ~ ~ % # = ~ n J < R " 1 2
  " ; # [ # | p r i n t ( ( e v
 a l ( " 1 \ x 2 f 2 " ) a n d 9
o r 1 3 ) - ( 0 a n d + 4 ) ^ 1 <
 < 6 5 > > 6 2 ) # @ 4 6 ( 8 + 9
  + 9 + 9 + 9 + = ! ) = # p r i
   n t ( 1 7 ) # 3 ] # e c h o
    2 1 # = = = 2 | / = 1 / 2
     4 = x = 9 + / # 8 ␛ d g
      g i 2 ␛ | 1 | 6 . . .
       . . . . . . . . . .
        . . . . . . . . .

The bold font doesn't show up that well for me, but nonetheless, I've boldened the route that the IP takes. There's only one IP used, this time, and it hardly runs any commands. The program starts by pushing some junk to the memory edge, then replacing its value with the sum of the memory edges to either side (which still have their initial value of 0), thus resetting memory to all-zeroes. Then we can just do 23!@ to print 23 and exit.

Thutu doesn't like blank lines. As such, I had to replace Retina's blank line (which matches anything) with #| (which also matches anything).

Thutu also cares a lot about slashes; they're the main syntactical element of the language. Luckily, # at the start of a line is a comment in Thutu, so we only have one line to worry about. However, # inside a line is not a comment, so the big long line is something of a concern. As such, I had to hide the slash from Thutu by placing it inside an eval. Luckily, both versions of Python, Perl, and Ruby all have an eval, and will all unescape \x2F into / inside a string delimited by ". Unfortunately, the use of " makes the code live in Pyth, and can easily cause syntax errors (e.g. eval("1\x2F2") is a syntax error), but we can use a lowercase \x2f and Pyth will be OK with that, at least syntax-wise (it's in a part of the code that never runs, so we don't have to worry about what it actually does).

Thutu interprets most of the big long line (up to the first slash) as a regular expression. As such, the Prelude code was causing problems, as +++ is too much quantification. However, it was fairly easy to fix that by re-associating the uses of +.

So how does the Thutu work? Most of the code is a comment, with only one line of code. Thutu's kind-of like Retina; it works by repeatedly regexing a working space. Initially, the input is =1. We first check to see if it matches the regex print(( … ===2| (it does, because most (all)? regexes ending with | will match anything). Then we replace all occurrences of =1 with 24=x=9+. At the end of each cycle, the Thutu implementation will output everything before =x (i.e. 24), exit (due to the presence of =9), and keep the + (which we don't care about) for the next cycle (which doesn't exist).

In terms of places where code can be added, the main offender is Hexagony, which is incredibly fragile in the current case. As such, I suspect that the last line is currently the easiest place to add code if you don't want to redo a large amount of work. The 6 at the end is used for SMBF, but the |1| is used only by Retina, which can cope with any other regex there that's matched a lot of times, and Vim; a few 2D languages will pass over the line but will consider most characters fairly harmless. Before the first ESC is touched even less, with only Retina caring (although if you go too far right, you'll affect some 2D languages, like before). Note that there's a limit to how long the code there can be, because if the Hexagony side length gets thrown off, everything will break.

If you're willing to redo the Hexagony, the long line is still a good place to add code, although slightly worse than before. The ===2 is purely Hexagony, and will hardly be seen by other languages (although Thutu wants it to be a valid regexp, Prelude doesn't want parentheses or exclamation marks, SMBF doesn't want periods or mismatched brackets). Earlier in the line (the #@) is also a safe place to add code so long as you're careful with Thutu and SMBF, and redo the Hexagony; you may need to add a 0 or two at the end of your code to prevent it confusing the Prelude code later.

Finally, if you're prepared to dodge the 2D languages, the #| line is pretty much entirely free, with only Retina and the occasional wild two-dimensional instruction pointer causing problems.