# 24. [Thutu](http://esolangs.org/wiki/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](http://esoteric.voxelperfect.net/files/thutu/impl/), 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!](https://tio.run/nexus/thutu#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB)

This program prints [**24** in Thutu](https://tio.run/nexus/thutu#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**23** in Hexagony](https://tio.run/nexus/hexagony#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**22** in Underload](https://tio.run/nexus/underload#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**21** in Nim](https://tio.run/nexus/nim#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**20** in Prelude](https://tio.run/nexus/prelude#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), **19** in Reng (test [here](https://jsfiddle.net/Conor_OBrien/avnLdwtq/)), [**18** in Cardinal](https://tio.run/nexus/cardinal#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**17** in Julia](https://tio.run/nexus/julia5#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**16** in Pyth](https://tio.run/nexus/pyth#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**15** in Haystack](https://tio.run/nexus/pyth#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**14** in Turtlèd](https://tio.run/nexus/turtled#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**13** in Ruby](https://tio.run/nexus/ruby#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**12** in Fission](https://tio.run/nexus/fission#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**11** in Befunge-98](https://tio.run/nexus/fission#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**10** in Befunge-93](https://tio.run/nexus/befunge#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**9** in Perl](https://tio.run/nexus/perl#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**8** in  Retina](https://tio.run/nexus/perl#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**7** in Japt](http://ethproductions.github.io/japt/?v=master&code=I3ZgMTYvIjwiNi9iLnFAIig6Oik6OjogICgyMilTIztuNCIxNCIKIz4zTjZAMTVvfD4gXip0dHQqfisrfn5+JQojPX5uSjxSIjEyIjsKI1sKI3wKcHJpbnQoKGV2YWwoIjFceDJmMiIpYW5kIDkgb3IgMTMpLSgwYW5kKzQpXjE8PDY1Pj42MikjQDQ2KDgrOSs5KzkrOSs9ISk9I3ByaW50KDE3KSMzXSNlY2hvIDIxIz09PTJ8Lz0xLzI0PXg9OSsvCiM4G2RnZ2kyG2AgfDF8Ng==&input=), [**6** in SMBF](https://tio.run/nexus/smbf#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**5** in Python 2](https://tio.run/nexus/python2#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**4** in ><>](https://tio.run/nexus/python2#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**3** in Minkolang](https://tio.run/nexus/minkolang#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), [**2** in Vim/V](https://tio.run/nexus/v#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB), and [**1** in Python 3](https://tio.run/nexus/python3#Lcy9bsIwFEDh3a/A4t6rSjZW694bY4iJo8wdOpSRH0ELBaQqaVGEGCy/elqp1Zm@5Qx43ZK3UIG3b4/fDagQdAhBSsWsFzhvHZADgXXx4huadKmWm3Hf9@NsTM75XmDM7XP1CsQwF7gUmMTX5dz2Sh2uu08FtLrxB4PetXtZyu4iqdAP6umXxukNVZWf1LVnjY3zambK/@Kdjvg3oqnGYo2H91MnmTDGyMlGsuziLZbGCpyN9sfjmUdbmSj5YfgB).

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:

<pre>
        <b># v 1 6 /</b> " &lt; " 6
       / b . q @ " ( : : )
      : : : ( 2 2 ) S # ; n
     4 " 1 4 " # &gt; 3 N 6 @ 1
    5 o | &gt; ^ * t t t * ~ + +
   ~ ~ ~ % # = ~ n J &lt; 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 &lt;
 &lt; 6 5 &gt; &gt; 6 2 ) # <b>@</b> 4 6 ( 8 + 9
  + 9 + 9 + 9 + = <b>!</b> ) = # p r i
   n t ( 1 7 ) # <b>3</b> ] # e c h o
    2 1 # = = = <b>2</b> | / = 1 / 2
     4 = x = 9 <b>+</b> / # 8 ␛ d g
      g i 2 ␛ <b>|</b> 1 | 6 . . .
       . . . . <b>.</b> . . . . .
        . . . . <b>.</b> . . . .
</pre>

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 <code>23!@</code> 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 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).

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.