A lot of new presets, renamed QWERTY to JCUKEN
This commit is contained in:
parent
13dbbeef18
commit
82a0ab9f83
10 changed files with 88 additions and 37 deletions
|
@ -2,7 +2,7 @@ const Stats = require('./stats');
|
|||
const Layout = require("./layout");
|
||||
const Runner = require("./runner");
|
||||
const { text, trigrams, docs, code } = require("./data");
|
||||
const { QWERTY, Workman, Colemak, Dvorak, Diktor } = require('./presets');
|
||||
const { JCUKEN, Workman, Colemak, Dvorak, Diktor, Diktor_VoronovMod, Redaktor, JUIYAF, Zubachev } = require('./presets');
|
||||
|
||||
const data = text;
|
||||
const runner = new Runner(data, { effortLimit: 40000000 });
|
||||
|
@ -59,10 +59,21 @@ const Halmak22 = new Layout("Halmak22", `
|
|||
F M V C / G P X K Y
|
||||
`);
|
||||
|
||||
const Ruhal1 = new Layout("Ruhal1", `
|
||||
\` 1 2 3 4 5 6 7 8 9 0 - =
|
||||
~ ! @ # $ % ^ & * ( ) _ +
|
||||
m e b o ' ] ; k h i [ w \\
|
||||
M E B O " } : K H I { W |
|
||||
f t j y / q d n c l , \\n
|
||||
F T J Y ? Q D N C L < \\n
|
||||
s z . g a v r p x u
|
||||
S Z > G A V R P X U
|
||||
`);
|
||||
|
||||
|
||||
|
||||
const LAYOUTS = [
|
||||
QWERTY, Workman, Colemak, Dvorak, Diktor, Halmak1, Halmak2, Halmak21, Halmak22
|
||||
JCUKEN, Diktor, Diktor_VoronovMod, Redaktor, JUIYAF, Zubachev, Ruhal1
|
||||
];
|
||||
|
||||
console.log("Running measurements...");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const Layout = require("./layout");
|
||||
const { FINGERS } = require("./config");
|
||||
const { QWERTY } = require("./presets");
|
||||
const { JCUKEN } = require("./presets");
|
||||
|
||||
const QWERTY_SEQUENCE = QWERTY.toSequence();
|
||||
const JCUKEN_SEQUENCE = JCUKEN.toSequence();
|
||||
const LOCK_POSITIONS = {}; `
|
||||
\`:\` 1:1 2:2 3:3 4:4 5:5 6:6 7:7 8:8 9:9 0:0 -:- =:=
|
||||
\\:\\
|
||||
|
@ -13,7 +13,7 @@ const LOCK_POSITIONS = {}; `
|
|||
const [key, value] = i.split(":");
|
||||
const normalize = v => v === "\\n" ? "\n" : v;
|
||||
|
||||
LOCK_POSITIONS[normalize(key)] = QWERTY_SEQUENCE.indexOf(normalize(value));
|
||||
LOCK_POSITIONS[normalize(key)] = JCUKEN_SEQUENCE.indexOf(normalize(value));
|
||||
});
|
||||
|
||||
// symbols that must be under the same hand
|
||||
|
@ -50,8 +50,8 @@ class Genome {
|
|||
}
|
||||
|
||||
// filling in the rest of symobls
|
||||
for (var i=0; i < QWERTY_SEQUENCE.length; i++) {
|
||||
const symbol = QWERTY_SEQUENCE[i];
|
||||
for (var i=0; i < JCUKEN_SEQUENCE.length; i++) {
|
||||
const symbol = JCUKEN_SEQUENCE[i];
|
||||
if (base.indexOf(symbol) === -1) {
|
||||
for (let j=0; j < base.length; j++) {
|
||||
if (base[j] === undefined) {
|
||||
|
@ -156,7 +156,7 @@ class Genome {
|
|||
return true; // already tried
|
||||
}
|
||||
|
||||
const hand_name = s => FINGERS[QWERTY_SEQUENCE[sequence.indexOf(s)]][0];
|
||||
const hand_name = s => FINGERS[JCUKEN_SEQUENCE[sequence.indexOf(s)]][0];
|
||||
|
||||
for (let i=0; i < SAME_HANDS.length; i++) {
|
||||
let current_hand = hand_name(SAME_HANDS[i][0]);
|
||||
|
@ -199,7 +199,7 @@ class Genome {
|
|||
|
||||
const STD_MAPPING = {};
|
||||
|
||||
QWERTY.config.trim().split("\n").forEach((line, i, list) => {
|
||||
JCUKEN.config.trim().split("\n").forEach((line, i, list) => {
|
||||
if (i % 2 === 0) {
|
||||
const shifted_line = list[i+1].trim().split(/\s+/);
|
||||
const normal_line = list[i].trim().split(/\s+/);
|
||||
|
|
|
@ -4,13 +4,13 @@ const { text, trigrams, code } = require("./data");
|
|||
const Stats = require("./stats");
|
||||
const Cluster = require("./cluster");
|
||||
const Population = require("./population");
|
||||
const { QWERTY, Diktor } = require("./presets");
|
||||
const { JCUKEN, Diktor, Diktor_VoronovMod, Redaktor, JUIYAF, Zubachev } = require("./presets");
|
||||
const { use_elites, mutate_levels, mutate_thresholds, max_no_chage, max_generation, population_size, POPULATION_SIZE } = require("./config");
|
||||
let { mutate_level } = require("./config");
|
||||
|
||||
const data = text;
|
||||
const cluster = new Cluster(data);
|
||||
const seed_layouts = [QWERTY, Diktor];
|
||||
const seed_layouts = [JCUKEN, Diktor, Diktor_VoronovMod, Redaktor, JUIYAF, Zubachev];
|
||||
|
||||
co(boot).catch(e => console.log(e.stack));
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const Genome = require("./genome");
|
||||
const { QWERTY } = require("./presets");
|
||||
const { JCUKEN } = require("./presets");
|
||||
const { POPULATION_SIZE } = require("./config");
|
||||
|
||||
module.exports = class Population {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
const Layout = require('./layout');
|
||||
|
||||
const presets = {
|
||||
QWERTY: `
|
||||
JCUKEN: `
|
||||
\` 1 2 3 4 5 6 7 8 9 0 - =
|
||||
~ ! @ # $ % ^ & * ( ) _ +
|
||||
q w e r t y u i o p [ ] \\
|
||||
|
@ -73,6 +73,46 @@ const presets = {
|
|||
E B T J F K Y N C H Q \\n
|
||||
a ' [ s . , v g u ;
|
||||
A " { S > < V G U :
|
||||
`,
|
||||
Diktor_VoronovMod: `
|
||||
\` 1 2 3 4 5 6 7 8 9 0 - =
|
||||
~ ! @ # $ % ^ & * ( ) _ +
|
||||
a m [ z s p d r l x i o \\
|
||||
A M { Z S P D R L X I O |
|
||||
e b t j f k y n c h q \\n
|
||||
E B T J F K Y N C H Q \\n
|
||||
/ ] ' / w / v g u ;
|
||||
? } " ? W ? V G U :
|
||||
`,
|
||||
Redaktor: `
|
||||
\` 1 2 3 4 5 6 7 8 9 0 - =
|
||||
~ ! @ # $ % ^ & * ( ) _ +
|
||||
w s z q m p l d r u i o \\
|
||||
W S Z Q M P L D R U I O |
|
||||
e b j t f k h n y c [ \\n
|
||||
E B J T F K H N Y C { \\n
|
||||
a . ' / / x v g , ;
|
||||
A > " ? ? X V G < :
|
||||
`,
|
||||
JUIYAF: `
|
||||
\` 1 2 3 4 5 6 7 8 9 0 - =
|
||||
~ ! @ # $ % ^ & * ( ) _ +
|
||||
q e b z a [ ; h / i w m \\
|
||||
Q E B Z A { : H ? I W M |
|
||||
d t f j x u n y c l , \\n
|
||||
D T F J X U N Y C L < \\n
|
||||
m ' . s o g r k p v
|
||||
M " > S O G R K P V
|
||||
`,
|
||||
Zubachev: `
|
||||
\` 1 2 3 4 5 6 7 8 9 0 - =
|
||||
~ ! @ # $ % ^ & * ( ) _ +
|
||||
a s f z / q v h g [ w o \\
|
||||
A S F Z ? Q V H G { W O |
|
||||
u b t j e k n c y p ; \\n
|
||||
U B T J E K N C Y P : \\n
|
||||
i m . / ' , l d r x
|
||||
I M > ? " < L D R X
|
||||
`
|
||||
};
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ function vs_known(total, vs) {
|
|||
}
|
||||
}
|
||||
|
||||
let qwerty;
|
||||
let jcuken;
|
||||
let diktor;
|
||||
|
||||
function rebuildLayoutsTable() {
|
||||
|
@ -187,7 +187,7 @@ function rebuildLayoutsTable() {
|
|||
return a.score.total > b.score.total ? -1 : 1;
|
||||
});
|
||||
|
||||
qwerty = sorted.filter(r => r.layout.name === "QWERTY")[0];
|
||||
jcuken = sorted.filter(r => r.layout.name === "JCUKEN")[0];
|
||||
diktor = sorted.filter(r => r.layout.name === "Diktor")[0];
|
||||
|
||||
const data = sorted.map(result => {
|
||||
|
@ -196,7 +196,7 @@ function rebuildLayoutsTable() {
|
|||
humanize(result.score.total),
|
||||
humanize(result.score.position),
|
||||
vs_known(result.score.total, diktor ? diktor.score.total : result.score.total),
|
||||
vs_known(result.score.total, qwerty ? qwerty.score.total : result.score.total)
|
||||
vs_known(result.score.total, jcuken ? jcuken.score.total : result.score.total)
|
||||
];
|
||||
})
|
||||
|
||||
|
@ -211,7 +211,7 @@ function rebuildLayoutsTable() {
|
|||
exports.vs_result = function vs_result(score) {
|
||||
return [
|
||||
vs_known(score.total, diktor.score.total),
|
||||
vs_known(score.total, qwerty.score.total)
|
||||
vs_known(score.total, jcuken.score.total)
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const Cluster = require('../src/cluster');
|
||||
const { QWERTY, Dvorak, Colemak, Workman } = require('../src/presets');
|
||||
const { JCUKEN, Dvorak, Colemak, Workman } = require('../src/presets');
|
||||
|
||||
const text = global.TEXT_FIXTUE;
|
||||
const layouts = [ QWERTY, Dvorak, Colemak, Workman, QWERTY, Dvorak, Colemak, Workman ];
|
||||
const layouts = [ JCUKEN, Dvorak, Colemak, Workman, JCUKEN, Dvorak, Colemak, Workman ];
|
||||
|
||||
describe('Cluster', () => {
|
||||
const cluster = new Cluster(text, {
|
||||
|
@ -24,8 +24,8 @@ describe('Cluster', () => {
|
|||
"Colemak - 771",
|
||||
"Dvorak - 595",
|
||||
"Dvorak - 595",
|
||||
"QWERTY - 420",
|
||||
"QWERTY - 420",
|
||||
"JCUKEN - 420",
|
||||
"JCUKEN - 420",
|
||||
"Workman - 859",
|
||||
"Workman - 859"
|
||||
]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Layout = require('../src/layout');
|
||||
const { DISTANCES, EFFORTS, FINGERS, ROWS } = require('../src/config');
|
||||
const QWERTY = `
|
||||
const JCUKEN = `
|
||||
\` 1 2 3 4 5 6 7 8 9 0 - =
|
||||
~ ! @ # $ % ^ & * ( ) _ +
|
||||
q w e r t y u i o p [ ] \\
|
||||
|
@ -12,10 +12,10 @@ const QWERTY = `
|
|||
`;
|
||||
|
||||
describe('Layout', () => {
|
||||
const layout = new Layout('QWERTY', QWERTY);
|
||||
const layout = new Layout('JCUKEN', JCUKEN);
|
||||
|
||||
it('has a name', () => {
|
||||
expect(layout).to.have.property('name', 'QWERTY');
|
||||
expect(layout).to.have.property('name', 'JCUKEN');
|
||||
});
|
||||
|
||||
it('can export itself in a pretty string', () => {
|
||||
|
@ -29,7 +29,7 @@ describe('Layout', () => {
|
|||
|
||||
it('can export itself into a sequence', () => {
|
||||
expect(layout.toSequence()).to.eql(
|
||||
'`1234567890-=qwertyuiop[]\\asdfghjkl;\'\nzxcvbnm,./'
|
||||
'`1234567890-=jcukenuiop[]\\asdfghjkl;\'\nzxcvbnm,./'
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Runner = require('../src/runner');
|
||||
const Layout = require('../src/layout');
|
||||
const { QWERTY, Dvorak, Colemak, Workman } = require('../src/presets');
|
||||
const { JCUKEN, Dvorak, Colemak, Workman } = require('../src/presets');
|
||||
const text = global.TEXT_FIXTUE;
|
||||
|
||||
describe('Runner', () => {
|
||||
|
@ -10,8 +10,8 @@ describe('Runner', () => {
|
|||
sameFingerPenalty: 5
|
||||
});
|
||||
|
||||
it('counts stuff in QWERTY', () => {
|
||||
const result = runner.typeWith(QWERTY);
|
||||
it('counts stuff in JCUKEN', () => {
|
||||
const result = runner.typeWith(JCUKEN);
|
||||
delete(result.counts);
|
||||
expect(result).to.eql({
|
||||
distance: 3138,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Stats = require('../src/stats');
|
||||
|
||||
const qwertyResult = {
|
||||
const jcukenResult = {
|
||||
position: 407,
|
||||
distance: 3285,
|
||||
effort: 2004,
|
||||
|
@ -52,48 +52,48 @@ const workmanResult = {
|
|||
};
|
||||
|
||||
describe('Stats', () => {
|
||||
const qwerty = new Stats(qwertyResult);
|
||||
const jcuken = new Stats(jcukenResult);
|
||||
const colemak = new Stats(colemakResult);
|
||||
const workman = new Stats(workmanResult);
|
||||
|
||||
it('calculates the total overheads', () => {
|
||||
expect(qwerty.overheads).to.eql(659);
|
||||
expect(jcuken.overheads).to.eql(659);
|
||||
expect(colemak.overheads).to.eql(499);
|
||||
expect(workman.overheads).to.eql(687);
|
||||
});
|
||||
|
||||
it('calculates fingers usage', () => {
|
||||
expect(qwerty.fingersUsage).to.eql([ 10, 9, 17, 24, 14, 10, 9, 7 ]);
|
||||
expect(jcuken.fingersUsage).to.eql([ 10, 9, 17, 24, 14, 10, 9, 7 ]);
|
||||
expect(colemak.fingersUsage).to.eql([ 11, 9, 11, 20, 15, 15, 11, 8 ]);
|
||||
expect(workman.fingersUsage).to.eql([ 11, 10, 13, 18, 12, 16, 10, 10 ]);
|
||||
});
|
||||
|
||||
it('calculates hands usage', () => {
|
||||
expect(qwerty.handsUsage).to.eql([ 60, 40 ]);
|
||||
expect(jcuken.handsUsage).to.eql([ 60, 40 ]);
|
||||
expect(colemak.handsUsage).to.eql([ 52, 48 ]);
|
||||
expect(workman.handsUsage).to.eql([ 52, 48 ]);
|
||||
});
|
||||
|
||||
it('calculates the rows usage', () => {
|
||||
expect(qwerty.rowsUsage).to.eql([ 0, 15, 34, 51 ]);
|
||||
expect(jcuken.rowsUsage).to.eql([ 0, 15, 34, 51 ]);
|
||||
expect(colemak.rowsUsage).to.eql([ 0, 12, 72, 16 ]);
|
||||
expect(workman.rowsUsage).to.eql([ 0, 14, 67, 19 ]);
|
||||
});
|
||||
|
||||
it('calculates the overall usage symmetry', () => {
|
||||
expect(qwerty.symmetry).to.eql(55);
|
||||
expect(jcuken.symmetry).to.eql(55);
|
||||
expect(colemak.symmetry).to.eql(76);
|
||||
expect(workman.symmetry).to.eql(68);
|
||||
});
|
||||
|
||||
it('calculates fingers load evenness', () => {
|
||||
expect(qwerty.evenness).to.eql(77);
|
||||
expect(jcuken.evenness).to.eql(77);
|
||||
expect(colemak.evenness).to.eql(82);
|
||||
expect(workman.evenness).to.eql(87);
|
||||
});
|
||||
|
||||
it('calculates the total score', () => {
|
||||
expect(qwerty.score).to.eql(515);
|
||||
expect(jcuken.score).to.eql(515);
|
||||
expect(colemak.score).to.eql(979);
|
||||
expect(workman.score).to.eql(1091);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue