Meet 4 Games and Animation for Terminal made with C++

Fun, learning and study reference.

Meet 4 Games and Animation for Terminal made with C++

Here on blog what else is content about graphics for terminal(TUI, Terminal User Interface) and command line, this blog lives up to its name 😎 .

And today we are going to increase this content by indicating some games and animations in the terminal that serve for purposes such as: fun, learning and studying the source code.

And in this case, we will indicate 4 software written in C++ that have an easy to understand code.

Let’s go to these 4 tips!



2048 is a puzzle game created in March 2014 by Italian developer Gabriele Cirulli, in which the objective is to slide numbered pieces in a grid, combining them and create a tile with the number 2048.

2048.cpp is the version of this game written in C++ . To compile you will need the following tools:

After having the compile-time dependencies, now just clone, build and install with the following commands:

git clone
cd 2048.cpp
mkdir build && cd build

After generating the binary, you can now play it! Just run:


On the first screen displayed, choose the desired option, that is, for a new game, press the number 1 and then press Enter .

   /\\\\\\\\\          /\\\\\\\                /\\\         /\\\\\\\\\
  /\\\///////\\\      /\\\/////\\\            /\\\\\       /\\\///////\\\
  \///      \//\\\    /\\\    \//\\\         /\\\/\\\      \/\\\     \/\\\
             /\\\/    \/\\\     \/\\\       /\\\/\/\\\      \///\\\\\\\\\/
           /\\\//      \/\\\     \/\\\     /\\\/  \/\\\       /\\\///////\\\
         /\\\//         \/\\\     \/\\\   /\\\\\\\\\\\\\\\\   /\\\      \//\\\
        /\\\/            \//\\\    /\\\   \///////////\\\//   \//\\\      /\\\
        /\\\\\\\\\\\\\\\   \///\\\\\\\/              \/\\\      \///\\\\\\\\\/
        \///////////////      \///////                \///         \/////////

  Welcome to 2048!

        1. Play a New Game
        2. Continue Previous Game
        3. View Highscores and Statistics
        4. Exit

  Enter Choice:

Then define the number of rows and columns of the game that somehow represents the level of difficulty, the minimum value is 3 (three) . For example, press 4(zero) and then press Enter and the game will start:

  (NOTE: Scores and statistics will be saved only for the 4x4 gameboard)
  Enter gameboard size - (Enter '0' to go back):

The mini tutorial for use can be found on the game screen itself:

  β”‚ SCORE:                 96 β”‚
  β”‚ BEST SCORE:            96 β”‚
  β”‚ MOVES:                 20 β”‚
  β”‚    2 β”‚   16 β”‚    4 β”‚      β”‚
  β”‚   16 β”‚    4 β”‚      β”‚      β”‚
  β”‚    4 β”‚      β”‚    2 β”‚      β”‚
  β”‚    2 β”‚      β”‚      β”‚      β”‚

  W or K or ↑ => Up
  A or H or ← => Left
  S or J or ↓ => Down
  D or L or β†’ => Right
  Z or P => Save
  Press the keys to start and continue.

If you want to exit the game press Ctrl + C .

To install just move this binary to some path contained in your $PATH variable, example:

sudo install -v 2048 /usr/local/bin

Then remove the cloned directory:

cd ../.. # If still inside build/
rm -rf 2048.cpp

And then when you want to play it, just run the command 2048 in the terminal.

There is an option to compile with Meson for more information see repository .

Also know another alternative to 2048.cpp a 2048 made in C: 2048-in-terminal.

Ascii Bird

Flappy Bird is a game initially developed for mobile by Vietnamese programmer Dong Nguyen.

Ascii Bird

The game is a side-scroller where the player controls a bird, trying to fly between columns of green pipes without hitting them.

Ascii Bird is a game based on Flappy Bird made with the library NCURSES created using only the characters from the table ASCII.

You will need the following tools to be able to build on your system:

After that run the commands:

git clone
cd AsciiBird

And to test, just run: ./flap .

The game will automatically load after the similar animation below:

                   ___ _                       ___ _        _
                  | __| |__ _ _ __ _ __ _  _  | _ |_)_ _ __| |
                  | _|| / _` | '_ \ '_ \ || | | _ \ | '_/ _` |
                  |_| |_\__,_| .__/ .__/\_, | |___/_|_| \__,_|
                             |_|  |_|   |__/

                              Press <up> to flap!

 [==============================================================         ]

After that it will automatically start, use the up ↑ and down ↓ directional keys to move the player.

To install just move this binary to some path contained in your $PATH variable, example:

sudo install -v flap /usr/local/bin

And when you want to play run: flap in the terminal . For more information see the repository .


Pong is a two-dimensional sports game that simulates table tennis. The player controls an in-game racket by moving it vertically across the screen.

They can compete against another player by controlling a second racket on the opposite side. Players use the paddles to hit a ball back and forth. The objective is for each player to reach eleven points before the opponent; Points are earned when one fails to return the ball to the other.

Pong was manufactured by Atari and originally released in 1972. It was one of the first successful arcade video games in the world.

There are several remakes of Pong, one of them is Pong written in C++ and NCURSES .

To install, remember to have the build dependencies: Git, g++ and GNU Make .

To install, run:

git clone
CD Pong
sed -i 's/-lncurses/-lncurses -ltinfo/g' Makefile

After compiled, run: ./pong and use the keys w, a, s and d for player 1 and ↑, β†’, ↓ and ← for player 2 to play. For more information visit the repository .

Pong C++

An alternative to this Pong is the PongC made in C that can be accessed here .


ASCII Rain is an animation of rain in the terminal.

You will ask:

β€” Why the hell do I want to watch rain in the terminal?

Well, this is really a legitimate question, but there is a culture called: unixporn who like to use these resources to improve their rice (term used to represent the combination of desktop environment customizations in a different way).

We have some articles in this regard and for more information click this link .

If you want to reproduce this rain in the terminal, install the dependencies(git, gcc and make). And then clone:

git clone


gcc rain.c -o rain -lncurses -ltinfo

Run and/or install:

sudo install -v rain /usr/local/bin



For more information visit the repository .

Installation tips

You noticed that almost all the applications we install in the system directory: /usr/local/bin and for that we need to use sudo .

Although there’s this in several tutorials on this blog including this article, I particularly don’t recommend it for security and organization reasons.

Install them only for your user, that is, isolating a little more.

For all cases do the following:

  • Create a sub directory in your local directory:
mkdir -p ~/.local/bin

Then add that directory to your $PATH variable:

To Bash

echo '${HOME}/.local/bin:${PATH}' >> ~/.bashrc

Close and then open your terminal or just run the commands below:

source ~/.bashrc
execute $SHELL

And every time you need to install a third-party application use this directory, for example:

install -v app ~/.local/bin

And instantly the command is already available in your terminal.

Better, right? πŸ˜ƒ

cpp cppdaily terminal unixporn