-1

Stephen Wolfram talked about this thing called cellular automaton. The idea was building what are seemingly complex systems from simple rules and starting configurations. Some examples such as Milton Bradley's game of life are demonstrated in this video.

Now I've heard up the grapevine that through the use of computer science arithmetic expressions can be modeled and solved. So for my final APCS project i want to take a given expression using +, -, *, or /, and model it with a cellular automaton. If anyone has resources that you could point me to or some ideas on how to approach this that would be greatly appreciated.

Curiosa Globunznik
  • 3,129
  • 1
  • 16
  • 24
  • Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Also check the [help/on-topic] to see what questions you can ask. – Progman Feb 09 '20 at 19:53
  • Super fun project. You might be biting off more than you can chew, though. I would use Conway's life and design some 2D format for input and output that actually looked like expressions (because it would be cool). I'm a professional software engineer, and I think it would take 2 months full time from scratch, unless I could find a bunch of stuff online that I could easily copy and leverage. – Matt Timmermans Feb 09 '20 at 22:24
  • @MattTimmermans Nice I/O may be an issue within Life itself I think. Check out the printer module in this [video of the 8-bit computer](https://www.youtube.com/watch?v=8unMqSp0bFY). But adding sort of UI that interacts with Life looks possible. – Curiosa Globunznik Feb 09 '20 at 22:38

1 Answers1

0

The name of the topic you chose is evaluation of arithmetic expressions, of which plenty of examples can be found, here they're discussing it.

A cellular automation with Rule 110 (see also this) is said to be Turing-complete in the sense that it can simulate a Turing machine, sort of minimal model of a computer.

So you'd need to find or write a compiler to a Turing machine, which translates arithmetic expressions to instructions, which the Turing machine can understand. Here they're discussing such stuff, citing an existing expressions-to-turing-machine-instructions compiler written in ruby.

Creating a parser for an expression langage isn't that hard really (its the hello-world example in the parser world), you could use Antlr, where you'll find complete examples, or rely on existing Java implementations.

The remaining part is an implementation of a Turing machine leveraging rule 110, which is able to execute the compiled code.

One would also have to tell the Turing machine how to add, subtract and so on, it can't do that by default. Here they're discussing addition, with links to subtraction and multiplication.

After some more research it turned out, that there is an existing Java implementation simulating a Turing machine in Conway's game of life, with some sample Turing-machine code by Paul Rendell running on it.

Also there is a universal Turing machine (one, that can simulate any other Turing machine) running in game of life mentioned by Rendell (als see this) and, eventually, even an 8-bit computer by Nicolas Loizeau running in game of life (resources on Github). If you'd use the latter, you'd have to compile to its instruction set, which may be way less uncomfortable than a plain Turing machine. Here's the code for the fibonacci numbers in that form:

write a 1
write b 1
add a b a
print a
add a b b
print b
goto 2
Curiosa Globunznik
  • 3,129
  • 1
  • 16
  • 24