Skip to main content
Share Your Experience: Take the 2024 Developer Survey
1200 votes
Accepted

Build a working game of Tetris in Conway's Game of Life

This began as a quest but ended as an odyssey. Quest for Tetris Processor, 2,940,928 x 10,295,296 The pattern file, in all its glory, can be found here, viewable in-browser here. This project is the ...
837 votes

Build a working game of Tetris in Conway's Game of Life

Part 2: OTCA Metapixel and VarLife OTCA Metapixel (Source) The OTCA Metapixel is a construct in Conway's Game of Life that can be used to simulate any Life-like cellular automata. As the LifeWiki (...
El'endia Starman's user avatar
801 votes

Build a working game of Tetris in Conway's Game of Life

Part 3: Hardware With our knowledge of logic gates and the general structure of the processor, we can start designing all the components of the computer. Demultiplexer A demultiplexer, or demux, is ...
K Zhang's user avatar
  • 7,116
760 votes

Build a working game of Tetris in Conway's Game of Life

Part 4: QFTASM and Cogol Architecture Overview In short, our computer has a 16-bit asynchronous RISC Harvard architecture. When building a processor by hand, a RISC (reduced instruction set computer)...
PhiNotPi's user avatar
  • 29.1k
713 votes

Build a working game of Tetris in Conway's Game of Life

Part 6: The Newer Compiler to QFTASM Although Cogol is sufficient for a rudimentary Tetris implementation, it is too simple and too low-level for general-purpose programming at an easily readable ...
Blue's user avatar
  • 28.5k
28 votes

Which tetromino is this?

Python 3, 124 bytes ...
lynn's user avatar
  • 68.7k
16 votes

Given a list of Tetris moves, return the number of completed lines

C, 401 392 383 378 374 351 335 324 320 318 316 305 bytes ...
Dave's user avatar
  • 8,479
16 votes

Wait, which tetromino was that?

JavaScript (ES10),  286  282 bytes Expects (a)(b), where \$a\$ and \$b\$ are 2 lists of binary strings. Returns an integer between \$0\$ and \$6\$ for ...
Arnauld's user avatar
  • 193k
15 votes

Programming Tetris Blocks (Literally)

C (gcc), 26x20 = 520 25x19 = 475 23x17 = 391 ...
gastropner's user avatar
  • 4,373
11 votes

Wait, which tetromino was that?

Brachylog, 156 124 bytes Takes two matrices, 1 indicating an empty tile, 2 indicating a tile with a piece. Maps ...
xash's user avatar
  • 11.3k
10 votes

Tetris! Final heights (Day 3)

JavaScript (Node.js),  286 284 270  266 bytes Pieces and positions are 0-indexed. Angles are in \$[0..3]\$. ...
Arnauld's user avatar
  • 193k
8 votes

Which tetromino is this?

APL (Dyalog), 95 94 93 89 87 bytes -2 thanks to Zacharý Requires ⎕IO←0 which is default on many systems. Takes Boolean matrix (of any shape!) as argument. Returns ...
Adám's user avatar
  • 30.3k
7 votes

Which tetromino is this?

JavaScript (ES6), 242 212 172 164 bytes ...
ETHproductions's user avatar
7 votes

Tetris! Final heights (Day 3)

C (clang), 253 239 221 212 bytes ...
Jin X's user avatar
  • 171
7 votes

Tetris strategy

C, score: 4136 (4290 - 154 bytes) ...
Lyth's user avatar
  • 781
6 votes
Accepted

Which tetromino is this?

Jelly,  54 43 42  41 bytes -1 byte thanks to Erik the Outgolfer (move transpose inside repeated chain) T€FṀ⁸ṙ€Zµ⁺F ZU$3СǀḄṂ“çc3Ð6'G‘i’ị“¥Çıƭ⁵» A monadic link ...
Jonathan Allan's user avatar
6 votes

Programming Tetris Blocks (Literally)

x86 opcode(.com), 86 82 bytes Tester: ...
l4m2's user avatar
  • 24.4k
5 votes
Accepted

Given a list of Tetris moves, return the number of completed lines

PHP, 405 399 378 372 368 360 354 347 331 330 328 319 309 300 bytes (with Dave´s block mapping) ...
Titus's user avatar
  • 14.7k
5 votes

Tetris! Final heights (Day 3)

C# (Visual C# Interactive Compiler), 308 bytes ...
dana's user avatar
  • 2,691
5 votes

Tetris! Final heights (Day 3)

Common Lisp, 634 bytes ...
Charlim's user avatar
  • 201
4 votes

Tetris! Final heights (Day 3)

Charcoal, 98 bytes Fθ«≔§⪪§⪪”)¶∧↷"e«↨U∧0%3;D∧⁼~h⊟⁵h/₂dΦ↗(EF”2⊟ι1⊟ιη≔⊟ιζW‹Lυ⁺ζLη⊞υ⁰≔⌈Eη⁻§υ⁺ζλ﹪Iκ³εFLη§≔υ⁺ζκ⁺ε⊕÷I§ηκ³»Iυ Try it online! Link is to verbose version ...
Neil's user avatar
  • 171k
3 votes

Which tetromino is this?

Retina, 125 bytes s`(.*1){5}.* {s`.*1111.* I s`.*111(.{2,4})1.* $.1 T`234`\LTJ s`.*11(.{2,4})11.* $.1 T`2-90`S\OZ4-9 s`.*4.* O#$`. $.%` O#$^` Try it online! ...
Neil's user avatar
  • 171k
3 votes

Which tetromino is this?

MATL, 60 bytes Itt6tIl7tl7H15vHe"4:"G@X!HYa]4$v@BIthYaEqY+4=aa]v'OSZLJTI'w) Input is a binary 4×4 array (matrix), using ...
Luis Mendo's user avatar
  • 105k
3 votes

Which tetromino is this?

Jelly, 53 bytes ZL0ẋW⁸tZµ⁺ZU$3С“©©“œ“Ç¿“¦©¦“ƽ‘;Uḃ2$’¤iЀṀị“÷¶Ė¡µỵỤ» Try it online! Full program. Takes a 4x4. Prints m if ...
Erik the Outgolfer's user avatar
2 votes
Accepted

Witness My Challenge (Tetris Puzzle)

Python, 992 Takes input from stdin and prints the solution. Note that SE has turned my tab characters into four spaces - anything indented beyond one space should be a tab. It shouldn't be too ...
cardboard_box's user avatar
2 votes

Given a list of Tetris moves, return the number of completed lines

PHP, 454 435 427 420 414 bytes bit fields for pieces and map; but no special case for the I shape as Dave´s golfing. ...
Titus's user avatar
  • 14.7k
2 votes

Given a list of Tetris moves, return the number of completed lines

Ruby, 474 443 428 379 + 48 = 427 bytes -1 thanks to @Titus This can definitely be golfed more. Reads a binary dictionary of pieces (see below) from STDIN or a filename and takes a move list as an ...
Jordan's user avatar
  • 10.1k
2 votes

Tetris Tangrams

Python 3, 819 bytes, M=0, Score=181 This is a brute force DFS program. It builds a numpy array, and inserts all the inputted holes. It then takes the leftmost unfilled tile on the highest row that ...
Vedvart1's user avatar
  • 179
2 votes

Which tetromino is this?

APL (Dyalog), 66 bytes {'TIOJSLZ-'[(¯51 144 64,,∘+⍨12J96 ¯48J64)⍳×/(+/-4×⊢)⍵/,0j1⊥¨⍳4 4]} Try it online! The arg is a boolean vector. Computes signed distances of ...
ngn's user avatar
  • 15.3k

Only top scored, non community-wiki answers of a minimum length are eligible