سؤال

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.

هل كانت مفيدة؟

المحلول

Each of the grid boxes is really a checkbox. Hitting space with it selected toggles its state.

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top