summaryrefslogtreecommitdiff
path: root/machine.lua
blob: 44f71467d093430a4be9f1067648a4e7fd57a6ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env lua
local eyes = require "eyes"
local reading = require "reading"
for _, message in ipairs(eyes) do
	local cip = require"automaton""abcdefghijklm opqrstuvxyz"
	local str = ""
	for index, a, b, c in reading.trigrams(message) do
		cip = cip:apply(a):apply(b):apply(c)
		local slot = 3
		if (index - 1) % 3 == 1 then
			slot = 19
		end
		str = str .. cip[slot]
	end
	print(str)
end