# nuno-faria/tetris-sql

Using SQL's Turing Completeness to Build Tetris

Repository: https://github.com/nuno-faria/tetris-sql
Canonical: https://ross.abutalabs.com/products/tetris-sql
Language: PLpgSQL
License: MIT
License Family: permissive
Topics: cte, sql, tetris, game
Last push: 2025-10-26T12:32:31+00:00

## Health v2 (maintenance only)
Score: 45/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 49, release rhythm 35, longevity 52
- inputs: {"age_days": 728, "days_push": 311, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1032, forks 43 (observed 2026-08-28T04:03:18.249144+00:00)

## What it is
A complete implementation of Tetris running inside a single PostgreSQL SQL query, exploiting the Turing completeness of recursive CTEs. A small Python helper script converts keyboard input into SQL commands, while the game logic, rendering, and state all live in SQL.

## Use cases
- play tetris in a postgres database
- demonstrate sql turing completeness
- learn recursive cte techniques
- novel demo for database conference talks
- explore what can be built in pure sql

## When to choose
- you want a fun, educational showcase of recursive CTEs in PostgreSQL
- you need a striking demo of SQL's computational power
- you already run PostgreSQL and want a novelty game

## When to avoid
- you need a practical or performant Tetris game
- you don't have a PostgreSQL server available
- you want maintainable game code in a general-purpose language

## Facets
- artifact type: application
- maturity: active
- function: game, interpreter, developer-tools
- domain: databases, gaming-tools, programming-languages
- platform: windows, cli
- tags: sql, postgresql, cte, recursive-cte, turing-complete, novelty-project, plpgsql, linux, macos, docker

## Member repositories
- nuno-faria/tetris-sql (main) score 45

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:18.249144+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:06:45.814742+00:00, confidence not recorded.
  - readme: https://github.com/nuno-faria/tetris-sql (fetched 2026-08-28T04:03:18.249144+00:00, sha 4bf15237af31)
- Data as of 2026-08-30T08:39:29.467469+00:00.
