HTML5+CSS3 中图灵完备规则 110 的实现是如何工作的?
今天早上,我在纯 HTML5 + CSS3(无 JavaScript)中遇到了以下规则 110 的实现。您按顺序按 Tab 和空格键来运行自动机。
http://elilies.com/rule110-full.html
我查看了源代码,但是我真的不明白它是如何跟踪状态的。当按下选项卡时,我认为 :focus 选择器会发挥作用,但我不确定按下空格时会发生什么。
This morning, I came across the following implementation of Rule 110 in pure HTML5 + CSS3 (no javascript). You press tab and space in sequence to run the automaton.
http://elilies.com/rule110-full.html
I looked at the source code, but I really can't figure out how it's keeping track of state. When tab is pressed, I figure that the :focus selectors come into play, but I am not sure what happens when space is pressed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您按下的按键是一个“外部循环”,它调用的代码未图灵完整:HTML + CSS(不包括 CSS Javascript 表达式...)总是停止,因此它不是图灵完整。
但是在循环中调用非图灵完备的代码可以使其图灵完备。
You pressing the keys are an "external loop" which is invoking code that is not turing complete: HTML + CSS (excluding CSS Javascript expressions...) always halts so it is not turing complete.
But calling non-turing-complete code in a loop can make it turing complete.
每个网格框实际上都是一个复选框。选中它后点击空格即可切换其状态。
Each of the grid boxes is really a checkbox. Hitting space with it selected toggles its state.