用元胞自动机计算算术表达式
Evaluation of arithmetic expressions with a cellular automaton
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。
现在我听说了通过使用计算机科学算术表达式可以建模和求解的小道消息。因此,对于我的最终 APCS 项目,我想使用 +、-、* 或 / 来获取给定的表达式,并使用元胞自动机对其进行建模。如果有人有资源可以指给我看,或者有一些关于如何解决这个问题的想法,我们将不胜感激。
你选的题目是算术表达式的求值,里面有很多例子,here他们正在讨论。
具有 Rule 110 (see also this) is said to be Turing-complete in the sense that it can simulate a Turing machine 的细胞自动化,有点像计算机的最小模型。
因此,您需要找到或编写图灵机编译器,将算术表达式转换为图灵机可以理解的指令。 Here they're discussing such stuff, citing an existing expressions-to-turing-machine-instructions 用 ruby.
编写的编译器
为表达式语言创建解析器实际上并不难(它是解析器世界中的 hello-world 示例),您可以使用 Antlr, where you'll find complete examples, or rely on existing Java implementations.
剩下的部分是利用规则 110 的图灵机的实现,它能够执行编译后的代码。
还必须告诉图灵机如何进行加法、减法等等,默认情况下它不能这样做。 Here 他们正在讨论加法,以及减法和乘法的链接。
经过更多研究后发现,上面有 Paul Rendell 运行 的 existing Java implementation simulating a Turing machine in Conway's game of life, with some sample Turing-machine code。
还有一个通用图灵机(一个,可以模拟任何其他图灵机)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
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。
现在我听说了通过使用计算机科学算术表达式可以建模和求解的小道消息。因此,对于我的最终 APCS 项目,我想使用 +、-、* 或 / 来获取给定的表达式,并使用元胞自动机对其进行建模。如果有人有资源可以指给我看,或者有一些关于如何解决这个问题的想法,我们将不胜感激。
你选的题目是算术表达式的求值,里面有很多例子,here他们正在讨论。
具有 Rule 110 (see also this) is said to be Turing-complete in the sense that it can simulate a Turing machine 的细胞自动化,有点像计算机的最小模型。
因此,您需要找到或编写图灵机编译器,将算术表达式转换为图灵机可以理解的指令。 Here they're discussing such stuff, citing an existing expressions-to-turing-machine-instructions 用 ruby.
编写的编译器为表达式语言创建解析器实际上并不难(它是解析器世界中的 hello-world 示例),您可以使用 Antlr, where you'll find complete examples, or rely on existing Java implementations.
剩下的部分是利用规则 110 的图灵机的实现,它能够执行编译后的代码。
还必须告诉图灵机如何进行加法、减法等等,默认情况下它不能这样做。 Here 他们正在讨论加法,以及减法和乘法的链接。
经过更多研究后发现,上面有 Paul Rendell 运行 的 existing Java implementation simulating a Turing machine in Conway's game of life, with some sample Turing-machine code。
还有一个通用图灵机(一个,可以模拟任何其他图灵机)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