0%

Writing Matrix-Style

Check out the reference

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <unistd.h>
int Modulus(int iN, int iMod) {
int iQ = (iN/iMod);
return iN - (iQ*iMod);
}
char GetChar(int iGenerator, char cBase, int iRange) {
return (cBase + Modulus(iGenerator, iRange));
}
int main() {
char caRow[80];
int j = 7;
int k = 2;
int l = 5;
int m = 1;
while (1) {
int i = 0;
while (i < 80) {
if (caRow[i] != ' ') {
caRow[i] = GetChar(j + i*i, 33, 30);
}
// colour output -- green
printf("\033[32m%c", caRow[i]);
++i;
}
j = (j + 31);
k = (k + 17);
l = (l + 47);
m = (m + 67);
caRow[Modulus(j, 80)] = '-';
caRow[Modulus(k, 80)] = ' ';
caRow[Modulus(l, 80)] = '-';
caRow[Modulus(m, 80)] = ' ';
usleep(10000);
}
return 0;
}