/cxxmatrix

C++ Matrix: The Matrix Reloaded in Terminals (Number falls, Banners, Matrix rains, Conway's Game of Life and Mandelbrot set)

Primary LanguageC++MIT LicenseMIT

C++ Matrix in terminal

I wrote a simple terminal program of Matrix digital rain. A part of the purpose of this program is to test the performance of terminal emulators. Another purpose is just for fun. Enjoy it with fast terminals (e.g., urxvt, alacritty, terminology, etc.)!

Features

  • Hankaku kana characters as in the original film
  • Ten levels of "green"s using terminal 256 color support
  • Twinkling effects by adding random brightness fluctuations
  • Diffused reflection effects by cell background colors

Scenes

By default, the following scenes will be visited in turn. If you want to see each scene, please see the help (cxxmatrix --help).

  1. Number falls
  2. Banner - Show command line arguments by shining characters
  3. "The Matrix" rain - Wikipedia
  4. Conway's Game of Life - Wikipedia
  5. The Mandelbrot set - Wikipedia
  6. (End scene) "The Matrix" rain

Demo

  • cxxmatrix in 80x28 - Youtube
  • The Mandelbrot set in 479x186 - YouTube
  • Highlight scenes - See the animated GIF below

Captures

Usage

This program is provided under the MIT License.

Requirements:

  • git, C++17 compiler, GNU make, GNU awk
  • UTF-8 support of the system
  • a fast terminal with 256color and UTF-8 support
$ git clone https://github.com/akinomyoga/cxxmatrix.git
$ cd cxxmatrix
$ make
$ ./cxxmatrix 'The Matrix' 'Reloaded'

Quit: C-c; Suspend: C-z; Menu: RET, C-m

Options

Check the help with cxxmatrix --help:

$ ./cxxmatrix --help
cxxmatrix (C++ Matrix)
usage: cxxmatrix [OPTIONS...] [[--] MESSAGE...]

MESSAGE
   Add a message for 'banner' scene.  When no messages are specified, a
   message "C++ MATRIX" will be used.

OPTIONS
   --help      Show help
   --          The rest arguments are processed as MESSAGE
   -m, --message=MESSAGE
               Add a message for 'banner' scene.
   -s, --scene=SCENE
               Add scenes. Comma separated list of 'number', 'banner', 'rain',
               'conway', 'mandelbrot', 'rain-forever' and 'loop'.
   -c, --color=COLOR
               Set color. One of 'default', 'black', 'red', 'green', 'yellow',
               'blue', 'magenta', 'cyan', 'white', and integer 0-255 (256 index
               color).

Keyboard
   C-c (SIGINT)  Quit
   C-z (SIGTSTP) Suspend
   
   C-m, RET      Show menu

Select scenes

# Example: Show the Mandelbrot set
./cxxmatrix -s mandelbrot

# Example: Loop Number falls and Conway's Game of Life
./cxxmatrix -s number,conway,loop

Install

$ sudo make install

The default install prefix is /usr/local. /usr/local/bin/cxxmatrix and /usr/local/share/man/man1/cxxmatrix.1.gz will be created. To change the install prefix, please specify the make variable PREFIX:

# Example 1
sudo make PREFIX=/opt/cxxmatrix install

# Example 2
make PREFIX=~/.local install

See also

Similar programs

Related tags in GitHub

The Matrix rains in terminals

The Matrix rains in browsers

Others

Videos