summaryrefslogtreecommitdiff
path: root/disk-simple-mask.lua
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-11-02 13:41:36 +0100
committerAki <please@ignore.pl>2024-11-02 13:41:36 +0100
commit0b0e02875dbc4d7d795cafe6e5720aa66b32e1ac (patch)
treee42c905d5d1ddde4c1bb1cf58fbf7d697c17616e /disk-simple-mask.lua
parent1a2c8b663ed89b4d4a75463e28260a7c4955ecb1 (diff)
downloadnoita-eyes-0b0e02875dbc4d7d795cafe6e5720aa66b32e1ac.zip
noita-eyes-0b0e02875dbc4d7d795cafe6e5720aa66b32e1ac.tar.gz
noita-eyes-0b0e02875dbc4d7d795cafe6e5720aa66b32e1ac.tar.bz2
Naive approach to disk-based masking directly on the trigrams
Diffstat (limited to 'disk-simple-mask.lua')
-rwxr-xr-xdisk-simple-mask.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/disk-simple-mask.lua b/disk-simple-mask.lua
new file mode 100755
index 0000000..ba41f7b
--- /dev/null
+++ b/disk-simple-mask.lua
@@ -0,0 +1,27 @@
+#!/usr/bin/env lua
+local disk = require "disk"
+local eyes = require "eyes"
+local format = require "format"
+local reading = require "reading"
+
+
+local function mask (ring, index, value)
+ local offset = (index - 1) % #ring
+ if ring[offset + 1] == 0 then
+ return value
+ else
+ return 0
+ end
+end
+
+
+for _, message in ipairs(eyes) do
+ local values = {}
+ for index, a, b, c in reading.trigrams(message) do
+ a = mask(disk.eyes1, index, a)
+ b = mask(disk.eyes2, index, b)
+ c = mask(disk.eyes3, index, c)
+ table.insert(values, reading.trigram_to_value(a, b, c))
+ end
+ print(format.ascii32(values))
+end