A minimal terminal Tetris written in Zig. Tested with Zig 0.13.0
zig build run. Cursor keys to move, q to quit.
This was a quick weekend project to get back into writing some Zig. I've never tried to implement Tetris, so it was a fun challenge.
Some notes for anyone looking at the code:
- It's messy and unoptimised. I was working out how to do it while doing it (and trying to remember Zig syntax)
Displayis a thin wrapper on top of themibuterminal library, it provides a double buffered one pixel per character interface where it only redraws changed pixels on the buffer flipStageis the game stage and provides a square pixel interface on top ofDisplay(by printing two chars for each pixel)Playerholds theTetronimoshapes and movement logicDebrisholds the list of fallen blocks for hitchecking and completed line detection
MIT