blob: d4ea301c2383be7a5f7bfa94941b992a844667d9 (
plain)
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
38
39
40
41
42
43
44
45
|
---
title: 'Matrix Rain: 2025 refactor'
date: 2025-12-21
layout: post
project: true
thumbnail: thumb_sm.png
---
Fixed the Unicode issue finally. Can now mix ASCII + Katakana.
Took me 2 hours to decipher how this even works. For future me: mat.col[]
stores shuffled column indices, mat.row[] tracks last updated row per column.
shuffle() randomizes the working set, index i (line 333) and lines 364-370 draw
one column at a time, swap() rotates columns in and out. That's the rain.
Moved Phosphor decay level into the LSB of the RGB union - should've done this
in 2022 instead of separate array. WTF was I thinking?
Keeping the RGB/PD union as it is. I know the 'portability' nerds hate it, but
I’m on a little-endian machine, and I’m the only one reading this. It’s
cleaner.
New charset array works. UNICODE(min, max) macro packs the range into uint64.
insert_code() picks random block, unpacks it, and picks random char. Elegant.
Looks a lot like the original now:
<video style="max-width:100%;" controls="" poster="poster.png">
<source src="matrix.mp4" type="video/mp4">
</video>
Using half-width Katakana (U+FF61-U+FF9F) because full-width characters break
columns.
blend() is still good, left it alone.
Tossed the license and automake cruft. Just `cc -O3 main.c -o matrix`. Don't
need the ceremony.
Performance regressions: none. Runs like a charm on the T490. 2% CPU. No
whirring fans.
Commit:
[03f8d87](https://git.asciimx.com/matrix-digital-rain/commit/?id=03f8d87ba7c2e46bd3f3cc4c772fb3a2ac740c92)
|