forked from michaeldickens/Typing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalues.c
More file actions
158 lines (135 loc) · 5.77 KB
/
values.c
File metadata and controls
158 lines (135 loc) · 5.77 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
* values.c
* Typing
*
* Created by Michael Dickens on 8/23/09.
*
*/
#include "values.h"
int initValues()
{
int i;
initCosts();
if (fullKeyboard == FK_NO) {
// Set keyboard position costs. These costs were determined by looking
// at how the positions were valued on some of the best alternative
// layouts.
static const int64_t costsCopy[KSIZE_MAX] = {
40, 40, 30, 40, 70, 80, 40, 30, 40, 40,
0, 0, 0, 0, 30, 30, 0, 0, 0, 0,
70, 70, 70, 50, 95, 60, 40, 60, 70, 70,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
} else if (fullKeyboard == FK_STANDARD) {
// These costs are optimized for a full standard layout. Any cost that
// is 999 is not supposed to contain any character.
static const int64_t costsCopy[KSIZE_MAX] = {
110, 100, 90, 75, 100, 120, 160, 100, 75, 90, 100, 110, 120, 999,
999, 40, 40, 30, 40, 70, 80, 40, 30, 40, 40, 60, 90, 140,
999, 0, 0, 0, 0, 30, 30, 0, 0, 0, 0, 50, 999, 999,
999, 70, 70, 70, 50, 95, 60, 40, 60, 70, 70, 999, 999, 999,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
} else if (fullKeyboard == FK_KINESIS) {
// These costs are optimized for Kinesis. Any cost that is 999 is not
// supposed to contain any character.
static const int64_t costsCopy[KSIZE_MAX] = {
120, 110, 100, 75, 100, 130, 130, 100, 75, 100, 110, 120,
90, 40, 40, 30, 40, 70, 70, 40, 30, 40, 40, 90,
60, 0, 0, 0, 0, 40, 40, 0, 0, 0, 0, 60,
999, 70, 70, 70, 50, 80, 80, 50, 70, 70, 70, 999,
999, 140, 140, 999, 999, 999, 999, 999, 999, 140, 140, 999,
0, 50, 999, 999, 999, 999, 999, 999, 999, 999, 50, 0,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
} else if (fullKeyboard == FK_IPHONE) {
// Thumbs are centered over the QWERTY D and K keys.
static const int64_t costsCopy[KSIZE_MAX] = {
45, 30, 20, 10, 20, 20, 10, 20, 30, 40,
20, 10, 0, 0, 10, 10, 0, 0, 10, 999,
999, 60, 50, 30, 20, 20, 50, 60, 999, 999,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
}
// Distance in mm.
trueDistance[ 0] = 19; trueDistance[ 1] = 19; trueDistance[ 2] = 19; trueDistance[ 3] = 19; trueDistance[ 4] = 28;
trueDistance[ 5] = 28; trueDistance[ 6] = 19; trueDistance[ 7] = 19; trueDistance[ 8] = 19; trueDistance[ 9] = 19;
trueDistance[10] = 0; trueDistance[11] = 0; trueDistance[12] = 0; trueDistance[13] = 0; trueDistance[14] = 19;
trueDistance[15] = 19; trueDistance[16] = 0; trueDistance[17] = 0; trueDistance[18] = 0; trueDistance[19] = 0;
trueDistance[20] = 19; trueDistance[21] = 19; trueDistance[22] = 19; trueDistance[23] = 19; trueDistance[24] = 28;
trueDistance[25] = 28; trueDistance[26] = 19; trueDistance[27] = 19; trueDistance[28] = 19; trueDistance[29] = 19;
// Based on distance from the ctrl key and how much of a stretch it is.
shortcutCosts[ 0] = 0; shortcutCosts[ 1] = 0; shortcutCosts[ 2] = 1; shortcutCosts[ 3] = 3; shortcutCosts[ 4] = 4;
shortcutCosts[ 5] = 8; shortcutCosts[ 6] = 10; shortcutCosts[ 7] = 10; shortcutCosts[ 8] = 10; shortcutCosts[ 9] = 10;
shortcutCosts[10] = 0; shortcutCosts[11] = 0; shortcutCosts[12] = 2; shortcutCosts[13] = 3; shortcutCosts[14] = 5;
shortcutCosts[15] = 8; shortcutCosts[16] = 10; shortcutCosts[17] = 10; shortcutCosts[18] = 10; shortcutCosts[19] = 10;
shortcutCosts[20] = 0; shortcutCosts[21] = 0; shortcutCosts[22] = 0; shortcutCosts[23] = 2; shortcutCosts[24] = 4;
shortcutCosts[25] = 8; shortcutCosts[26] = 10; shortcutCosts[27] = 10; shortcutCosts[28] = 10; shortcutCosts[29] = 10;
return 0;
}
void initCosts()
{
detailedOutput = TRUE;
keepZXCV = FALSE;
keepQWERTY = FALSE;
keepNumbers = 0;
keepParentheses = TRUE;
keepShiftPairs = FALSE;
keepTab = FALSE;
keepConsonantsRight = FALSE;
keepNumbersShifted = FALSE;
zCost = 10;
xCost = 6;
cCost = 12;
vCost = 14;
qwertyPosCost = 14;
qwertyFingerCost = 4;
qwertyHandCost = 20;
parenthesesCost = 5000000;
numbersShiftedCost = -1000000;
if (fullKeyboard == FK_KINESIS) {
fingerPercentMaxes[0] = fingerPercentMaxes[FINGER_COUNT - 1] = 7.5;
fingerPercentMaxes[1] = fingerPercentMaxes[FINGER_COUNT - 2] = 10.0;
fingerPercentMaxes[2] = fingerPercentMaxes[FINGER_COUNT - 3] = 20.0;
fingerPercentMaxes[3] = fingerPercentMaxes[FINGER_COUNT - 4] = 20.0;
fingerPercentMaxes[4] = fingerPercentMaxes[FINGER_COUNT - 5] = 18.0;
} else {
fingerPercentMaxes[0] = fingerPercentMaxes[FINGER_COUNT - 1] = 9.0;
fingerPercentMaxes[1] = fingerPercentMaxes[FINGER_COUNT - 2] = 11.5;
fingerPercentMaxes[2] = fingerPercentMaxes[FINGER_COUNT - 3] = 22.0;
fingerPercentMaxes[3] = fingerPercentMaxes[FINGER_COUNT - 4] = 22.0;
fingerPercentMaxes[4] = fingerPercentMaxes[FINGER_COUNT - 5] = 18.0;
}
fingerWorkCosts[0] = fingerWorkCosts[FINGER_COUNT - 1] = 40;
fingerWorkCosts[1] = fingerWorkCosts[FINGER_COUNT - 2] = 30;
fingerWorkCosts[2] = fingerWorkCosts[FINGER_COUNT - 3] = 20;
fingerWorkCosts[3] = fingerWorkCosts[FINGER_COUNT - 4] = 20;
fingerWorkCosts[4] = fingerWorkCosts[FINGER_COUNT - 5] = 20;
// All values are compounding. For example, say we jump over the home row
// on the index finger. The cost is sameHand + rowChange + homeJump + homeJumpIndex.
distance = 1;
inRoll = -40;
outRoll = 5;
sameHand = 5;
sameFingerP = 150;
sameFingerR = 140;
sameFingerM = 110;
sameFingerI = 90;
sameFingerT = 100;
rowChangeDown = 10;
rowChangeUp = 15;
handWarp = 25;
handSmooth = - 5;
homeJump = 100;
homeJumpIndex = -90;
doubleJump = 220; // Does not compound with homeJump.
ringJump = 40;
toCenter = 30;
toOutside = 30;
shiftCost = 100;
doubleShiftCost=150;
}