• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.gitignoreH A D28-Jun-202167 97

GNUmakefileH A D03-May-20221.6 KiB6138

LICENSE.mdH A D28-Jun-20211 KiB2217

README.mdH A D28-Jun-202110.3 KiB200155

conway.hppH A D28-Jun-20213.6 KiB121105

cxxmatrix.1H A D28-Jun-20212.4 KiB11084

cxxmatrix.cppH A D28-Jun-202148.5 KiB1,8051,618

cxxmatrix.hppH A D28-Jun-20211.3 KiB6555

glyph.awkH A D28-Jun-20211.1 KiB6453

glyph.defH A D28-Jun-20218.5 KiB188137

mandel.hppH A D28-Jun-20218.7 KiB268231

README.md

1# C++ Matrix in terminal
2
3I wrote a simple terminal program of Matrix digital rain.
4A part of the purpose of this program is to test the performance of terminal emulators.
5Another purpose is just for fun.
6Enjoy it with fast terminals (e.g., urxvt, alacritty, terminology, etc.)!
7
8**Features**
9
10- Hankaku kana characters as in the original film
11- Ten levels of "green"s using terminal 256 color support
12- Twinkling effects by adding random brightness fluctuations
13- Diffused reflection effects by cell background colors
14
15**Scenes**
16
17By default, the following scenes will be visited in turn.
18If you want to see each scene, please see the help (`cxxmatrix --help`).
19
201. Number falls
212. Banner - Show command line arguments by shining characters
223. "The Matrix" rain - [Wikipedia](https://en.wikipedia.org/wiki/Matrix_digital_rain)
234. Conway's Game of Life - [Wikipedia](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)
245. The Mandelbrot set - [Wikipedia](https://en.wikipedia.org/wiki/Mandelbrot_set)
256. (End scene) "The Matrix" rain
26
27## Demo
28
29- cxxmatrix in 80x28 - [Youtube](https://www.youtube.com/watch?v=DeKuT8txldc)
30- The Mandelbrot set in 479x186 - [YouTube](https://www.youtube.com/watch?v=RtMy4ltebKw)
31- Highlight scenes - See the animated GIF below
32
33![Captures](https://raw.githubusercontent.com/wiki/akinomyoga/cxxmatrix/images/cxxmatrix-version01sA.gif)
34
35## Usage
36
37This program is provided under the [MIT License](LICENSE.md).
38
39**Requirements**:
40
41- git, C++17 compiler, GNU make, GNU awk
42- UTF-8 support of the system
43- a fast terminal with `256color` and UTF-8 support
44
45```console
46$ git clone https://github.com/akinomyoga/cxxmatrix.git
47$ cd cxxmatrix
48$ make
49$ ./cxxmatrix 'The Matrix' 'Reloaded'
50```
51
52Quit: <kbd>C-c</kbd>; Suspend: <kbd>C-z</kbd>; Menu: <kbd>RET</kbd>, <kbd>C-m</kbd>
53
54**Options**
55
56Check the help with `cxxmatrix --help`:
57
58```console
59$ ./cxxmatrix --help
60cxxmatrix (C++ Matrix)
61usage: cxxmatrix [OPTIONS...] [[--] MESSAGE...]
62
63MESSAGE
64   Add a message for 'banner' scene.  When no messages are specified, a
65   message "C++ MATRIX" will be used.
66
67OPTIONS
68   --help      Show help
69   --          The rest arguments are processed as MESSAGE
70   -m, --message=MESSAGE
71               Add a message for 'banner' scene.
72   -s, --scene=SCENE
73               Add scenes. Comma separated list of 'number', 'banner', 'rain',
74               'conway', 'mandelbrot', 'rain-forever' and 'loop'.
75   -c, --color=COLOR
76               Set color. One of 'default', 'black', 'red', 'green', 'yellow',
77               'blue', 'magenta', 'cyan', 'white', and integer 0-255 (256 index
78               color).
79   --frame-rate=NUM
80               Set the frame rate per second.  A positive number less than or
81               equal to 1000. The default is 25.
82   --error-rate=NUM
83               Set the factor for the rate of character changes.  A
84               non-negative number.  The default is 1.0.
85   --diffuse
86   --no-diffuse
87               Turn on/off the background-color effect.  Turned on by default.
88   --twinkle
89   --no-twinkle
90               Turn on/off the twinkling effect.  Turned on by default.
91   --preserve-background
92   --no-preserve-background
93               Preserve terminal background or not.  Not preserve by default.
94   --rain-density=NUM
95               Set the factor for the density of rain drops.  A positive
96               number.  The default is 1.0.
97
98Keyboard
99   C-c (SIGINT)  Quit
100   C-z (SIGTSTP) Suspend
101
102   C-m, RET      Show menu
103```
104
105**Select scenes**
106
107```console
108# Example: Show the Mandelbrot set
109./cxxmatrix -s mandelbrot
110
111# Example: Loop Number falls and Conway's Game of Life
112./cxxmatrix -s number,conway,loop
113```
114
115## Install
116
117
118```console
119$ sudo make install
120```
121
122The default install prefix is `/usr/local`. `/usr/local/bin/cxxmatrix` and `/usr/local/share/man/man1/cxxmatrix.1.gz` will be created.
123To change the install prefix, please specify the make variable `PREFIX`:
124
125```bash
126# Example 1
127sudo make PREFIX=/opt/cxxmatrix install
128
129# Example 2
130make PREFIX=~/.local install
131```
132
133### See also
134
135- AUR Package: [AUR (en) - cxxmatrix-git](https://aur.archlinux.org/packages/cxxmatrix-git/) by @ignapk
136- FreeBSD Package: [misc/cxxmatrix](https://www.freshports.org/misc/cxxmatrix)
137
138# Similar programs
139
140Related tags in GitHub
141
142- [`#matrix-rain`](https://github.com/topics/matrix-rain)
143- [`#matrix-digital-rain`](https://github.com/topics/matrix-digital-rain)
144
145## The Matrix rains in terminals
146
147- [abishekvashok/cmatrix](https://github.com/abishekvashok/cmatrix) - [Demo](https://github.com/abishekvashok/cmatrix#screencasts) in C (1967)
148- [will8211/unimatrix](https://github.com/will8211/unimatrix) - [Demo](https://github.com/will8211/unimatrix#screenshots) in Python3 (1246)
149- akinomyoga/cxxmatrix in C++ (488)
150- [M4444/TMatrix](https://github.com/M4444/TMatrix) - [Demo](https://github.com/M4444/TMatrix#how-it-looks), [Reddit](https://www.reddit.com/r/unixporn/comments/btg6rj/oc_tmatrix_a_new_terminal_digital_rain_simulator/) in C++ (234)
151- [GeertJohan/gomatrix](https://github.com/GeertJohan/gomatrix) - [Youtube](https://www.youtube.com/watch?v=mUXFxSmZMis) in Go (221)
152- [nojvek/matrix-rain](https://github.com/nojvek/matrix-rain) - [Demo](https://github.com/nojvek/matrix-rain#screenshots) in Node (80)
153- [levithomason/cmatrix](https://github.com/levithomason/cmatrix) - [Demo](https://github.com/levithomason/cmatrix#cmatrix) in C (61)
154- [torch2424/wasm-matrix](https://github.com/torch2424/wasm-matrix) - [Demo](https://github.com/torch2424/wasm-matrix#wasm-matrix) in WASM (58)
155- [cowboy8625/rusty-rain](https://github.com/cowboy8625/rusty-rain) - [Demo](https://github.com/cowboy8625/rusty-rain#----------rusty-rain----), [Reddit](https://www.reddit.com/r/rust/comments/llauze/cross_platform_matrix_rain/) in Rust (44)
156- [jsbueno/terminal_matrix](https://github.com/jsbueno/terminal_matrix) - [Demo](https://github.com/jsbueno/terminal_matrix#python-script-to-simulate-the-matrix-screensaver-effect-in-a-posix-terminal) in Python (35)
157- [joechrisellis/pmatrix](https://github.com/joechrisellis/pmatrix) - [Demo](https://github.com/joechrisellis/pmatrix#pmatrix-in-action) in Python (33)
158- [domsson/fakesteak](https://github.com/domsson/fakesteak) - [Demo](https://github.com/domsson/fakesteak#fakesteak), [Reddit](https://www.reddit.com/r/unixporn/comments/ju62xa/oc_fakesteak_yet_another_matrix_rain_generator/) in C (25)
159- [amstrad/oh-my-matrix](https://github.com/amstrad/oh-my-matrix) - [Demo](https://github.com/amstrad/oh-my-matrix/blob/master/oh-my-matrix.gif) in Python (18)
160- [b166erobot/matrix](https://github.com/b166erobot/matrix) in Python3 (17)
161- [meganehouser/rustmatrix](https://github.com/meganehouser/rustmatrix) - [Demo](https://github.com/meganehouser/rustmatrix#rustmatrix) in Rust (16)
162- [txstc55/matrix_viewer](https://github.com/txstc55/matrix_viewer) - [Demo](https://github.com/txstc55/matrix_viewer#matrix-viewer) in C++ (14)
163- [aguegu/greenrain](https://github.com/aguegu/greenrain) - [Demo](https://github.com/aguegu/greenrain#greenrain) in C++ (6)
164- [JaydenL33/cmatrix2.0](https://github.com/JaydenL33/cmatrix2.0) in C (3)
165- [stefrush/enterthematrix](https://github.com/stefrush/enterthematrix) - [Demo](https://github.com/stefrush/enterthematrix#enterthematrix) in Python (2)
166- [Shizcow/smatrix](https://github.com/Shizcow/smatrix) in Rust (1)
167- [gurushida/matrixmirror](https://github.com/gurushida/matrixmirror) - [Demo](https://github.com/gurushida/matrixmirror#matrixmirror) in Objective-C (0)
168- [roee30/rmatrix](https://github.com/roee30/rmatrix) in Rust (0)
169
170## The Matrix rains in browsers
171
172- [tidwall/digitalrain](https://github.com/tidwall/digitalrain) - [Demo](https://tidwall.com/digitalrain/) in HTML5 Canvas (341)
173- [emilyxxie/green_rain](https://github.com/emilyxxie/green_rain) - [Demo](http://xie-emily.com/generative_art/green_rain.html) in HTML5 Canvas (200)
174- [winterbe/github-matrix](https://github.com/winterbe/github-matrix) - [Demo](https://winterbe.com/projects/github-matrix/) in HTML5 Canvas (182)
175- [neilcarpenter/Matrix-code-rain](https://github.com/neilcarpenter/Matrix-code-rain) - [Demo](http://neilcarpenter.com/demos/canvas/matrix/) in HTML5 Canvas (88)
176- [Rezmason/matrix](https://github.com/Rezmason/matrix) - [Demo](https://rezmason.github.io/matrix/) in HTML5 Canvas (65)
177- [syropian/HTML5-Matrix-Code-Rain](https://github.com/syropian/HTML5-Matrix-Code-Rain) - [Demo](https://codepen.io/syropian/pen/bLzAi) in HTML5 Canvas (31)
178- [raphaklaus/matrix-fx](https://github.com/raphaklaus/matrix-fx) - [Demo](https://raphaklaus.com/matrix-fx/) in CSS3 (24)
179- [pazdera/matrix-vr](https://github.com/pazdera/matrix-vr) - [Demo](https://radek.io/matrix-vr/) in WebVR (17)
180- [lhartikk/BtcTxMatrix](https://github.com/lhartikk/BtcTxMatrix) - [Demo](http://lhartikk.github.io/btctxmatrix/) in HTML5 Canvas (13)
181- [anderspitman/redpill](https://github.com/anderspitman/redpill) - [Demo](https://anderspitman.net/apps/redpill/) in HTML5 Canvas (9)
182- [pmutua/Matrix-Rain](https://github.com/pmutua/Matrix-Rain) - [Demo](https://pmutua.github.io/Matrix-Rain/) in HTML5 Canvas (2)
183- [zhaihaoran/digital-rain](https://github.com/zhaihaoran/digital-rain) - [Demo](https://zhaihaoran.github.io/digital-rain/) in HTML5 Canvas (1)
184- [Workvictor/pixi-digital-rain](https://github.com/Workvictor/pixi-digital-rain) - [Demo](https://victorpunko.ru/development/digital-rain-v3/) in HTML5 Canvas (0)
185- [azder/ES2017-Matrix-Rain](https://github.com/azder/ES2017-Matrix-Rain) - [Demo](https://azder.github.io/ES2017-Matrix-Rain/) in HTML5 Canvas (0)
186- [codingotaku/7-Segment-Digital-Matrix-Rain](https://github.com/codingotaku/7-Segment-Digital-Matrix-Rain) - [Demo](https://codingotaku.com/7-Segment-Digital-Matrix-Rain/) in HTML5 Canvas (0)
187
188## Others
189
190- [winterbe/github-matrix-screensaver](https://github.com/winterbe/github-matrix-screensaver) (github-matrix/WebSaver?) in JavaScript (440)
191- [tremby/Kaleidoscope-LEDEffect-DigitalRain](https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain) in Kaleidoscope? (22)
192- [nathanchere/MatrixSaver](https://github.com/nathanchere/MatrixSaver) in C# (22)
193- [sapandang/Matrix-Rain-Live-Wallpaper](https://github.com/sapandang/Matrix-Rain-Live-Wallpaper) in Android Wallpaper (14)
194- [Sullivan008/CSharp-MatrixRain](https://github.com/Sullivan008/CSharp-MatrixRain) in C# (1)
195- [artgl42/MatrixDigitalRain](https://github.com/artgl42/MatrixDigitalRain) - [Demo](https://github.com/artgl42/MatrixDigitalRain#matrixdigitalrain-dll) in C# (0)
196
197## Videos
198
199- [Chuvas da Matrix - YouTube](https://www.youtube.com/watch?v=y9wD8Nck1VA)
200