summaryrefslogtreecommitdiff
path: root/ioc-delta.lua
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-11-02 22:24:01 +0100
committerAki <please@ignore.pl>2024-11-02 22:24:01 +0100
commitcc77d7ccc034aecba64278e43112a61cf8c7f12c (patch)
tree61b107ba7a9c0b784f5ac8f655e23d1dc58fe4e7 /ioc-delta.lua
parent1abde5fcd3fde372cdefdc6c967d680a2cc82410 (diff)
downloadnoita-eyes-cc77d7ccc034aecba64278e43112a61cf8c7f12c.zip
noita-eyes-cc77d7ccc034aecba64278e43112a61cf8c7f12c.tar.gz
noita-eyes-cc77d7ccc034aecba64278e43112a61cf8c7f12c.tar.bz2
Calculate delta bar IoC for 2-124 long periods
Diffstat (limited to 'ioc-delta.lua')
-rwxr-xr-xioc-delta.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/ioc-delta.lua b/ioc-delta.lua
new file mode 100755
index 0000000..e6dd656
--- /dev/null
+++ b/ioc-delta.lua
@@ -0,0 +1,22 @@
+#!/usr/bin/env lua
+local eyes = require "eyes"
+local reading = require "reading"
+local stats = require "stats"
+local messages = reading.all_tvalues(eyes)
+for period=2, 124 do -- Second longest message
+ local global = stats(tostring(period))
+ local positions = {}
+ for i=1, period do
+ positions[i - 1] = global:sub(string.format(" > %d", i))
+ end
+ for _, message in ipairs(messages) do
+ for index, value in ipairs(message) do
+ positions[(index - 1) % period]:add(value)
+ end
+ end
+ local sum = 0
+ for _, pos in pairs(positions) do
+ sum = sum + pos:ioc(global.letters)
+ end
+ io.write(period, ",", sum / period, "\n")
+end