-
Notifications
You must be signed in to change notification settings - Fork 12
/
finger.go
52 lines (43 loc) · 916 Bytes
/
finger.go
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
package main
type Finger int
var FingerMap map[rune]Finger
const (
NoFinger Finger = 0
LeftPinky Finger = 1 << iota
LeftRing
LeftMiddle
LeftIndex
LeftThumb
RightThumb
RightIndex
RightMiddle
RightRing
RightPinky
)
var FingerSequence = []Finger{
LeftPinky, LeftRing, LeftMiddle, LeftIndex, LeftThumb,
RightThumb, RightIndex, RightMiddle, RightRing, RightPinky,
}
var sourceMap = map[Finger]string{
LeftPinky: "1qazQAZ`~!",
LeftRing: "2wsxWSX@",
LeftMiddle: "3edcEDC#",
LeftIndex: "4rfvRFV5tgbTGB$%",
LeftThumb: " ",
RightThumb: " ",
RightIndex: "6yhnYHN7ujmUJM^&",
RightMiddle: "8ikIK*,<",
RightRing: "9olOL(.>",
RightPinky: "0pP)-_=+[{]}\\|'\"/?",
}
func init() {
FingerMap = make(map[rune]Finger)
for finger, runes := range sourceMap {
for _, r := range runes {
if _, ok := FingerMap[r]; !ok {
FingerMap[r] = NoFinger
}
FingerMap[r] |= finger
}
}
}