blob: e6dd656020afb22ea00f04843ef7da0cd7b8d818 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
|