diff options
Diffstat (limited to 'ioc-delta.lua')
-rwxr-xr-x | ioc-delta.lua | 22 |
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 |