From cc77d7ccc034aecba64278e43112a61cf8c7f12c Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 2 Nov 2024 22:24:01 +0100 Subject: Calculate delta bar IoC for 2-124 long periods --- ioc-delta.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 ioc-delta.lua (limited to 'ioc-delta.lua') 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 -- cgit v1.1