#!/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