AoC 2017 Day 25: Turing

Source: The Halting Problem

Part 1: Implement a Turing machine defined as such:

Begin in state A. Perform a diagnostic checksum after 6 steps.

In state A: If the current value is 0: - Write the value 1. - Move one slot to the right. - Continue with state B. If the current value is 1: - Write the value 0. - Move one slot to the left. - Continue with state B.


What the (be)funge‽

Here’s a fun little bit of code for you:

55*4*v    _   v
v   <>:1-:^
    |:<$      <    ,*48 <
    @>0"zzif">:#,_$      v
>:3%!|    >0"zzub">:#,_$^
v "buzz"0<>:.           ^
         |!%5:           <
>:#,_   $>              ^

Gibberish you say? No! Befuge!


Parallel BF

Getting a bit close to the deadline, but I think I have something that’s pretty interesting. Basically, it’s the same BF interpreter that I wrote about yesterday with four additional commands:

&Spawn a new thread; set the current cell to 0 in the parent and 1 in the child
~Kill the current thread
!Send a ping on the channel specified by the current cell
?Wait for a ping on the channel specified by the current cell


A Brainf**k Interpreter

The PLT Games website has a competition going where each month there will be some sort of theme for a completely new program. The first theme is a Turing Tarpit–a language that is technically Turing complete and thus can do anything any other Turing complete language can, but is so minimal as to make doing anything worthwhile overly difficult.

  1. Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy. – Alan Perlis, Epigrams on Programming

To that end, I’ve been working on a little something special which I may or may not finish by the end of the month (yes, I know that’s tomorrow). But while I was working on it, I put together a Brainf**k (BF) interpreter which I found pretty interesting to play with.