문제

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