Cloned Games

Tetris-SQL

SporadicPlayableNone

Based on Tetris

Tetris-SQL screenshotLinks, repository & details

About

Tetris is a puzzle video game created by Alexey Pajitnov in the mid-1980s, in which falling four-block tetrominoes are stacked and cleared by filling complete horizontal lines. Tetris-SQL is a complete implementation of Tetris written as a single PostgreSQL query, using recursive common table expressions to drive the game loop, the `dblink` extension to read live player input, and `RAISE NOTICE` output to render the board in a terminal. It requires a PostgreSQL server (tested on versions 10 through 18) and a small Python helper script to relay player input.

How it differs from the original

Unlike a typical Tetris implementation, the entire game runs as a single SQL query inside the database engine — a separate Python script only relays player input into the database — so it's playable only via a terminal with a running Postgres server, not as a standalone program.

Getting started

Run a PostgreSQL server (Docker setup steps are provided in the repo) with the `dblink` extension enabled, start the input-relay script in one terminal, and execute the Tetris SQL query in a second terminal to play.

History

The project's implementation techniques were presented as a talk at PGConf.EU 2025.

Additional notes

Technical note
Postgres keeps all intermediate rows generated by the game's recursive query, so memory and disk usage grow continuously the longer a session runs.
Share:

More like Tetris-SQL

Active
Ebitengine screenshot
Ebitengine is an open-source, cross-platform 2D game engine for Go, with simple APIs for graphics, input, and audio across many platforms.
Platforms:Web
Stars13,485
Updated1 month ago
LicenseApache-2.0
Release2013
Halted
Original game (original game, not this project)Original game image
A web-based puzzle game inspired by Tetris, playable directly in the browser with no installation required.
Platforms:Web
Stars2,435
Updated3 years ago
LicenseUnknown
Release2014
Halted
Javascript Tetris screenshot
A basic MIT-licensed HTML5 canvas implementation of Tetris for major browsers, with development halted before planned features were added.
Platforms:Web
Stars733
Updated1 year ago
LicenseMIT
Release2011
Halted
NullpoMino screenshot
An open-source Java falling-block puzzle game with many single-player modes and Internet/LAN netplay.
Platforms:WindowsLinuxOSX
Stars565
Updated5 years ago
LicenseBSD-3-Clause
Release2016
Active
Seed7 screenshot
An open-source programming language whose example programs include recreations of classic games like Pac-Man and Tetris.
Platforms:Windows
Stars461
Updated1 month ago
LicenseGPL-2.0
Release2020
Halted
Original game (original game, not this project)Original game image
canvas-tetris is a simple HTML5 Canvas implementation of Tetris, built as an educational example in about 45 minutes.
Platforms:Web
Stars451
Updated2 years ago
LicenseMIT
Release2012