Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Probably not. There is a lot of optimizations browsers do to make the stylesheets super fast[1], and I think quite a few of those rely on CSS not being Turing complete.

1: https://hacks.mozilla.org/2017/08/inside-a-super-fast-css-en...



CSS is Turing complete :-) You can find pure-CSS implementations of Game of Life, for instance.


The implementations I have seen rely on the inclusion of HTML form elements, and a manual step to update the state.

So in that sense CSS + HTML + User Interaction is Turing complete. But that is a different language then CSS, even if a part of that language happens to be written in CSS.


https://propjockey.github.io/css-conways-game-of-life/infini... as an example. No user interaction except to start.


This is impressive. 43000 lines of CSS. Do you know how this works?

EDIT: For the record, while I am very impressed, and this is a wonderful work of art we can all enjoy, I am not convinced this is proof of the Turing completeness of CSS. At most this would prove that CSS + HTML is Turing complete (which still better then CSS + HTML + User instructions in natural language). But I wonder if in these 43000 lines of CSS the entire state space was encoded (with some clever compression obviously), and I am not sure if that would count as proof of Turing completeness.


I haven't looked into it, but most of these tend to do clever tricks with CSS animations. https://dev.to/janeori/expert-css-the-cpu-hack-4ddj is by the same author, IIRC, and explains some of it.

CSS alone is not Turing-complete (AFAIK), because you don't have anywhere to attach state (the computed style) if you don't have a DOM and loops are generally prohibited. But CSS exists literally only to style a DOM, so I don't consider that all that much of a concession.


I don’t think that’s true, unless you count hardcoding the state evolution into CSS variables, one var per cell per step.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: