TIS-100 Sequence Indexer

Sequence Indexer program
Sequence Indexer program

It’s been long enough that I should go over what TIS-100 _IS_. TIS-100 is a programming puzzle game by the makers of SpaceChem (a previous obsession). Where SpaceChem kind of hid the programming knowledge necessary to solve the puzzles beneath a fun graphical abstraction, TIS-100 just strips away the candy coating. TIS-100 simulates a fictional multicore reduced instruction set computer (RISC). There is no RAM. Sometimes there is a stack or two. Each processor has just one directly-accessible register.

This is SUCH a niche game. Take your set of gamers. From that, select the ones that are programmers or who are interested in programming. From that, select the ones that have experience with assembly language, or are interested in programming at the chip level. From that, select the ones that love optimizing machine code. For a computer that doesn’t exist.

There is a very thin plot to TIS-100, exposed a fragment at a time in notes left by your crazy uncle, the uncle who left you this mystery computer after his tragic death. I’m just two segments from the end….

Segment 62711 – Sequence Indexer

  1. Sequences are zero terminated
  2. Read a sequence from IN.0
  3. Read index values from IN.X
  4. Look up index values in sequence
  5. Write indexed value to OUT

The processor diagram for this puzzle has two stack nodes with a processor node between them that provide a clue to the solution. The data will be read into the top stack, then we will build a node that moves data from one stack to the other until the correct value is on top of the bottom stack. Then the output node will read this value and… output it.

The first time I tried this puzzle, several months ago, I got stuck trying to limit the amount of data being moved from one stack to the other and I just got overwhelmed. This time, I got a basic solution running and then added the smarter stack management (that’s the node on the middle left).

I got as far as I could, fighting sleep. The automated analysis showed my solution was faster than most, but not fastest by a long shot. I found a much faster solution on the Internet. This better solution was roughly similar, but it included a fast path for when the index was the same as the previous index. It also moved the calculation of the necessary stack motion to the index input node. Mine is way over to the other side, and precious cycles are wasted getting it there. This other solution is the first place I have seen the Jump Relative Offset (JRO) instruction used.

Well, I bow to the better programmer, but I am happy with my solution :)

Next: A Sequence Sorter!

TIS-100: A puzzle from the dawn of computing

I think you wanted to make that zero a four?
I think you wanted to make that zero a four?

If you ever thought back with longing to beautiful summer days spent filling out code sheets with a worn-down pencil and a well-thumbed processor instruction code book your only companions, well, Zachtronics' TIS-100 might just be your worst nightmare.

The thin plot has your Aunt Doris sending you a bunch of your recently-deceased uncle's belongings, including the TIS-100 and its manual, the last thing on which he was working. Because of some cryptic hints in the manual, and because you have more curiosity than sense, you decide to recreate his work and discover the hidden purpose of this mysterious device.

All this is merely a wrapper to the meat of the game, which is to write programs in assembly language to solve little problems. The TIS-100 is comprised of up to twelve processing nodes which run independently, connected to adjacent nodes via ports. There is no RAM, and the instruction set is 70s-era microprocessor simple.

Like its predecessor, SpaceChem, TIS-100 is a puzzle game where solving the challenge is usually only the start of the fun. The number of nodes you used, the execution time, and the number of instructions used is compared to everyone else who has solved the puzzle. Your solution too slow? Back to the drawing board.

TIS-100 is in Steam early access, but I'm not seeing anything terribly unfinished about it. The user interface is fairly functional, and that's part of its charm. You can even go full screen for the complete old-school experience.

I just can't imagine anyone but programmers, especially those of us who actually had to do this kind of stuff back in the day, really enjoying this. The manual is minimal (but hilarious in a geeky way). The TIS-100 doesn't do a fantastic job of introducing people to parallel programming or even the sort of assembly language likely to be used by anyone — this is a really stripped down set.

That said, you may just have found the hardcore programming game you never knew you were missing. SpaceChem with all that distracting space and chemistry stuff removed…. I'm having a heck of a great time with it.