/
letters.lua
127 lines (122 loc) · 3.5 KB
/
letters.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
-- local classic = require "https://raw.githubusercontent.com/rxi/classic/master/classic.lua"
local classic = require "./classic"
local Object = classic
local Letter = Object:extend()
function Letter:new(...)
local squares = {...}
local height = 2
local width = #squares / 2
local cm = {}
local n = 1
for j = 1, height do
for i = 1, width do
if not cm[i] then
cm[i] = {}
end
local t = {}
t.top = not (not squares[n].top)
t.bottom = not (not squares[n].bottom)
t.left = not (not squares[n].left)
t.right = not (not squares[n].right)
cm[i][j] = t
n = n + 1
end
end
self.height = height
self.width = width
self.cm = cm
end
letters = {
A = Letter(
{
top = true,
left = true,
right = true,
bottom = true
},
{
top = true,
left = true,
right = true
}
),
B = Letter(
{
top = true,
left = true,
right = true,
bottom = true
},
{
top = true,
left = true,
right = true,
bottom = true
}
),
C = Letter({top = true, left = true}, {left = true, buttom = true}),
D = Letter(
{
left = true,
top = true,
right = true
},
{left = true, bottom = true, right = true}
),
E = Letter({top = true, left = true, bottom = true}, {top = true, left = true, bottom = true}),
F = Letter(
{
top = true,
left = true,
bottom = true,
left = true,
top = true
}
),
G = Letter(
{
top = true,
left = true
},
{
left = true,
bottom = true,
right = true
}
),
H = Letter({left = true, bottom = true, right = true}, {left = true, top = true, right = true}),
I = Letter({left = true}, {left = true}),
J = Letter({right = true}, {left = true, bottom = true, right = true}),
K = Letter({left = true, bottom = true, right = true}, {left = true, top = true, right = true}),
L = Letter({left = true}, {left = true, bottom = true}),
M = Letter(
{left = true, top = true, right = true},
{left = true},
{left = true, top = true, right = true},
{right = true}
),
N = Letter({left = true, top = true, right = true}, {left = true, right = true}),
O = Letter({left = true, top = true, right = true}, {left = true, bottom = true, right = true}),
P = Letter({left = true, top = true, right = true, bottom = true}, {left = true, top = true}),
Q = Letter(
{left = true, top = true, right = true},
{left = true, bottom = true, right = true},
{left = true},
{left = true, bottom = true}
),
R = Letter({left = true, top = true, right = true, bottom = true}, {left = true, top = true, right = true}),
S = Letter({left = true, top = true, bottom = true}, {top = true, right = true, bottom = true}),
T = Letter({top = true, right = true}, {right = true}, {top = true, left = true}, {left = true}),
U = Letter({left = true, right = true}, {left = true, bottom = true, right = true}),
V = Letter({left = true, right = true}, {left = true, bottom = true, right = true}),
W = Letter(
{left = true},
{left = true, bottom = true, right = true},
{right = true},
{left = true, bottom = true, right = true}
),
X = Letter({left = true, bottom = true, right = true}, {left = true, top = true, right = true}),
Y = Letter({left = true, bottom = true, right = true}, {top = true, right = true, bottom = true}),
Z = Letter({top = true, right = true, bottom = true}, {top = true, left = true, bottom = true})
}
return letters