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
233 lines (200 loc) · 8.26 KB
/
values.c
File metadata and controls
233 lines (200 loc) · 8.26 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/*
* values.c
* Typing
*
* Created by Michael Dickens on 8/23/09.
*
*/
#include "values.h"
int initValues()
{
int i;
initCosts();
if (fullKeyboard == K_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 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 == K_STANDARD) {
// These costs are optimized for a full standard layout. Any cost that
// is 999 is not supposed to contain any character.
static 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 == K_KINESIS) {
// These costs are optimized for Kinesis. Any cost that is 999 is not
// supposed to contain any character.
static 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 == K_IPHONE) {
// Thumbs are centered over the QWERTY D and K keys.
static 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];
} else if (fullKeyboard == K_LAPTOP) {
// These costs are optimized for a full standard layout. Any cost that
// is 999 is not supposed to contain any character.
static 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,
999, 999, 999, 999, 0, 20, 20, 0, 999, 999, 999, 999, 999, 999,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
} else if (fullKeyboard == K_CRKBD) {
// These costs are optimized for Kinesis. Any cost that is 999 is not
// supposed to contain any character.
static int64_t costsCopy[KSIZE_MAX] = {
40, 40, 30, 40, 80, 20, 20, 80, 40, 30, 40, 60,
0, 0, 0, 0, 50, 0, 0, 50, 0, 0, 0, 0,
90, 70, 40, 30, 90, 20, 20, 90, 30, 40, 70, 90,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
} else if (fullKeyboard == K_NOT) {
// Set keyboard position costs. These costs were determined by looking
// at how the positions were valued on some of the best alternative
// layouts.
static int64_t costsCopy[KSIZE_MAX] = {
40, 40, 30, 40, 80, 999, 999, 80, 40, 30, 40, 60,
0, 0, 0, 0, 50, 0, 0, 50, 0, 0, 0, 0,
90, 70, 40, 30, 90, 999, 999, 90, 30, 40, 70, 90,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
} else if (fullKeyboard == K_NOTT) {
// Set keyboard position costs. These costs were determined by looking
// at how the positions were valued on some of the best alternative
// layouts.
static int64_t costsCopy[KSIZE_MAX] = {
40, 40, 30, 40, 80, 20, 20, 80, 40, 30, 40, 60,
0, 0, 0, 0, 50, 0, 0, 50, 0, 0, 0, 0,
90, 70, 40, 30, 60, 999, 999, 60, 30, 40, 70, 90,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
} else if (fullKeyboard == K_ADHD) {
// Set keyboard position costs. These costs were determined by looking
// at how the positions were valued on some of the best alternative
// layouts.
static int64_t costsCopy[KSIZE_MAX] = {
40, 40, 30, 40, 20, 20, 40, 30, 40, 60,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
90, 70, 40, 30, 999, 999, 30, 40, 70, 90,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
} else if (fullKeyboard == K_TRAN) {
// Set keyboard position costs. These costs were determined by looking
// at how the positions were valued on some of the best alternative
// layouts.
static int64_t costsCopy[KSIZE_MAX] = {
40, 40, 30, 40, 20, 20, 90, 40, 30, 40, 60, 110,
0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 90,
90, 70, 40, 30, 999, 999, 30, 40, 70, 90,
};
for (i = 0; i < ksize; ++i)
distanceCosts[i] = costsCopy[i];
}
// 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;
/* If you do not wish to use multithreading, set numThreads to 1. */
numThreads = 1;
keepZXCV = FALSE;
keepQWERTY = FALSE;
keepNumbers = 1;
keepBrackets = TRUE;
keepShiftPairs = FALSE;
keepTab = FALSE;
keepConsonantsRight = FALSE;
keepNumbersShifted = FALSE;
zCost = 10;
xCost = 6;
cCost = 12;
vCost = 14;
qwertyPosCost = 14;
qwertyFingerCost = 4;
qwertyHandCost = 20;
bracketsCost = 5000000;
numbersShiftedCost = -1000000;
if (fullKeyboard == K_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.
*/
sfmult = 3;
irmult = 3;
distance = 1;
inRoll = -40*irmult;
outRoll = -5;
sameHand = 5;
sameFingerP = 150*sfmult;
sameFingerR = 140*sfmult;
sameFingerM = 110*sfmult;
sameFingerI = 90*sfmult;
sameFingerT = 100*sfmult;
rowChangeDown = 0;
rowChangeUp = 0;
handWarp = 25;
handSmooth = - 5;
homeJump = 0;
homeJumpIndex = 0;
doubleJump = 0; /* Does not compound with homeJump. */
ringJump = 0;
toCenter = 100;
toOutside = 30;
shiftCost = 100;
doubleShiftCost=150;
}