Skip to content

efoxepstein/stupid-machines

Repository files navigation

⚙️ Stupid Machines🦾

Is bunch of useless implementations of our favorite abstract machines, including Turing machines, the Rule 110 cellular automata, and cyclic tag systems.

Live demo:

Raw file

rule110

Implements rule 110 in HTML and CSS3. This is a more correct "proof" that CSS is Turing-complete.

rule110-old/

Implements rule 110 in HTML and CSS3. This was the first "proof" that CSS is Turing-complete. It is not a valid proof.

  • rule110-a.html is a very simple demo of an individual cell
  • rule110-grid.html and rule110-full.html are two different presentations of the cellular automaton.

TuringMachineWithNoSemicolons.java

Implements a Turing machine in Java without using a single semicolon in the file. Languages like Ruby and Python don't use semicolons, so why should my Java?

while(!args[1].equals(args[4]) && !args[1].equals(args[5])){
    if((args[1] + args[0].charAt(Integer.parseInt(args[2]))).equals(args[3].substring(0,2))){

        // Write
        if((        args[0] = args[0].substring(0, Integer.parseInt(args[2])) +
                              args[3].charAt(3) +
                              args[0].substring(Integer.parseInt(args[2])+1, args[0].length())
        ) == ""){}

        if(args[3].charAt(2) == 'L'){
            if((    args[2] = (Integer.parseInt(args[2])-1) + ""            ) != ""){}                    
        }else{
            if((    args[2] = (Integer.parseInt(args[2])+1) + ""            ) != ""){}
        }

        // Update current state
        if((        args[1] = args[3].charAt(4) + ""                        ) != ""){}

    }else{
        // Cycle transition table
        if((args[3] = args[3].substring(5, args[3].length()) + args[3].substring(0,5)) != ""){}
    }
}
if(args[1].equals(args[4])){
    if(System.out.printf("REJECT: " + args[0]) == null){}
}else if(System.out.printf("ACCEPT: " + args[0]) == null){}

TuringMachineWithNoSyntax.java

Implements a Turing machine in Java without using control structures, variable declarations, method definitions, or anonymous classes. The main2 method shows the code before I removed variables. Control structures are too controlling for this day and age. Us youth yearn for the unstructured hippie days of our parents' generations.

short_cyclic_tag_system.rb

a='11001';%w[010 000 1111].cycle{|x|(p a)>'09'&&a<<x;a[0]=''}

This is the shortest implementation of an abstract machine that I could think of. If you have ideas to improve, send a pull request. Verbosity is a sin.

About

Experimentations with Abstract Machines

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published