Get the latest tech news
Show HN: Using SQL's Turing completeness to build Tetris
Using SQL's Turing Completeness to Build Tetris. Contribute to nuno-faria/tetris-sql development by creating an account on GitHub.
For instance, if we took the CTE that generates a sequence of numbers and removed the stop condition, the query would hang and not show any output, unlike an infinite loop + print in a language such as C. Once again, a recursive CTE is used to aid this task: the base value is set to -1 and, at each iteration, it moves the piece down by one line until it collides with an existing one or reaches the end of the board. Since the default value of the work_mem parameter is relatively low (4MB), Postgres will also use temporary files to store the partial results, meaning disk usage also increases continuously.
Or read this on Hacker News