turing:用于图灵机的Python库

时间:2021-04-28 18:17:17
【文件属性】:
文件名称:turing:用于图灵机的Python库
文件大小:10KB
文件格式:ZIP
更新时间:2021-04-28 18:17:17
Python 用法 import turing machine = turing.Machine(program, tape, h=0, s="0") machine.run(steps=1e309, debug=False) machine.count(tally="1") 其中program是如下所示的Turing Machine程序, tape是tape的初始状态(例如,如果您要在一元中表示17,请使用tape = "1" * 17 ), h是磁头的初始位置, s是初始状态。 steps是将要运行的最大步骤数(默认为无穷大)。 具有相同参数(状态和输入相同)的多个连续步骤称为缩放步骤,效率更高,计数为一个步骤的1/3。 machine.count()是可选的,将从磁带的开头开始计数连续的1 s(或其他指定的标记)的数量。 这对于使用一元代码很有用。 0 , "0" , 1e309 , Fal
【文件预览】:
turing-master
----todo.txt(83B)
----README.md(4KB)
----turing.py(6KB)
----test_programs.py(3KB)
----programs()
--------2-1s()
--------unary-to-binary()
--------halt-iff-0()
--------switch()
--------double-with-0()
--------double()
----.gitattributes(30B)

网友评论