Tetrois (Console Tetris) banner

Tetrois (Console Tetris)

4 devlogs
6h 38m 22s

This C++ program offers a lightweight Tetris experience that runs directly within your terminal using ANSI escape codes for vibrant block colors. The logic is self-contained and efficient, ensuring smooth gameplay without the need for heavy external graphical libraries. To track your progress, the application automatically maintains a local highscore file that saves your best performances across different sessions.

This project uses AI

Github Copilot line completion / helping by transition to ncurses

Demo Repository

Loading README...

jonas.gaden

Shipped this project!

I updated the replay mechanism, you can now press space to play again. In addition, some code clean up was done,

jonas.gaden

I updated the replay mechanism, you can now press space to play again. In addition, some code clean up was done, and i noticed that the time has been tracked in two different Hackatime project (opsi). Nevertheless, here is a better explanation why I switched to Ncurses (effectivly dropping Windows support):
In the initial C++ version, rendering was a manual battle against screen flicker. You had to calculate terminal dimensions using ioctl, manually position the cursor and manage color states with ANSI codes. To prevent the screen from strobing every frame, the code relied on a custom “line-diffing” algorithm that only updated lines that had actually changed. This worked, but it was brittle. If the terminal resized or if a single character was miscounted, the entire layout would shatter. That is completely gone with the new Ncurses version.

Attachment
0
jonas.gaden

I switched to ncurses for overall better performance and visual layout (at the expense that the app does not longer work on Windows), but accidentally deleted my latest blogpost (no clue what i was doing)

Changelog

Attachment
Attachment
0
jonas.gaden

Version v0.1

  • Playable version
  • Full ANSI Color support
  • Work in progress version
Attachment
Attachment
1

Comments

GreemDev
GreemDev about 1 month ago

I want to try it! Is it compatible with Linux Ubuntu?