Skip to content

Commit 3e96a85

Browse files
committed
Added learning cost
1 parent f126e93 commit 3e96a85

5 files changed

+65
-17
lines changed

ArsoniteLayout v1.psd

629 KB
Binary file not shown.

ArsoniteLayout.psd

37.4 KB
Binary file not shown.

index.html

+24-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ <h2>
2222
Arsonite is an efficient keyboard layout with minimal changes from QWERTY and almost all
2323
changes are symmetrical swaps, making it very easy to learn.
2424
</h2>
25+
<h3>Design Goals</h3>
26+
<ul>
27+
<li><strong>Efficency:</strong> Keep most frequently used letters on the home row</li>
28+
<li><strong>Minimal Changes:</strong> Change as less as possible, to make the layout easy to learn and minimize shortcut changes</li>
29+
<li><strong>Easy learning:</strong> Swap keys, instead of moving them around. if you make a
30+
mistake, all you have to do is use the key that you got to get the key you want. </li>
31+
</ul>
2532

2633
<div id="downloads">
2734
<span>Windows</span>
@@ -70,6 +77,10 @@ <h2>
7077
<div id="layouts-all">
7178
<div id="layout-template" class="layout" style="display: none">
7279
<h3></h3>
80+
<div>
81+
<span>Learning Cost</span>
82+
<span class="learning-cost"></span>
83+
</div>
7384
<div>
7485
<span>Distance</span>
7586
<span class="distance"></span>
@@ -122,14 +133,23 @@ <h3></h3>
122133
K.Stats = [];
123134
K.AddLayout = function(layoutName, keymap){
124135
var layout = $("#layout-template").clone().attr("id",layoutName);
125-
layout.find("h2").text(layoutName);
136+
layout.find("h3").text(layoutName);
126137
layout.show();
127138
layout.appendTo($("#layouts-all"));
128139

129140
var stats = new CKeyStats(layoutName, keymap);
130141
K.Stats.push(stats);
131142
};
132143

144+
K.CalculateAllCosts = function(){
145+
var text = $("#text").val();
146+
147+
K.Stats.forEach(function(e, i, a){
148+
e.calculate(text);
149+
e.displayStats($("#" + e.name));
150+
});
151+
};
152+
133153
// Qwerty already added as a starting point
134154

135155
K.dvorakMap = [
@@ -157,17 +177,13 @@ <h3></h3>
157177
];
158178

159179
K.AddLayout("qwerty");
160-
K.AddLayout("dvorak", K.dvorakMap);
161180
K.AddLayout("arsonite", K.arsoniteMap);
181+
K.AddLayout("dvorak", K.dvorakMap);
162182
K.AddLayout("colemak", K.colemakMap);
183+
K.CalculateAllCosts();
163184

164185
$("#process").click(function(){
165-
var text = $("#text").val();
166-
167-
K.Stats.forEach(function(e, i, a){
168-
e.calculate(text);
169-
e.displayStats($("#" + e.name));
170-
});
186+
K.CalculateAllCosts();
171187
});
172188

173189

keyboard.js

+36-9
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ function CKeyboard(keymap){
4343
this.ROWS = 5;
4444
this.COLUMNS = 15;
4545

46-
this.defaultKeyboard =
46+
this.learningCost = 0;
47+
48+
this.qwertyKeymap =
4749
[ // lowercase, uppercase
48-
"`1234567890-=\\", "~!@#$%^&*()_+|" ,
49-
" qwertyuiop[]" , " QWERTYUIOP{}" ,
50-
" asdfghjkl;'\n" , " ASDFGHJKL:\"\n",
51-
" zxcvbnm,./" , " ZXCVBNM<>?" ,
52-
" " , ""
50+
"`1234567890-=", "~!@#$%^&*()_+" ,
51+
" qwertyuiop[]\\", " QWERTYUIOP{}|" ,
52+
" asdfghjkl;'\n" , " ASDFGHJKL:\"\n",
53+
" zxcvbnm,./" , " ZXCVBNM<>?" ,
54+
" " , ""
5355
];
5456

5557
this.defaultFingering =
@@ -61,6 +63,7 @@ function CKeyboard(keymap){
6163
" 8"
6264
];
6365

66+
this.keymap = this.qwertyKeymap;
6467
this.charToIndex = {};
6568
this.keyArea = Array2D(this.ROWS, this.COLUMNS);// area of image
6669
this.keyFinger = Array2D(this.ROWS, this.COLUMNS);
@@ -133,19 +136,43 @@ CKeyboard.prototype.isSettable = function(row, col) {
133136
};
134137

135138
CKeyboard.prototype.setDefaultKeys = function() {
136-
for (var i=0; i < this.defaultKeyboard.length; i+=2) {
137-
this.setRow(i/2,this.LOWERCASE, this.defaultKeyboard[i]);
138-
this.setRow(i/2,this.UPPERCASE, this.defaultKeyboard[i+1]);
139+
for (var i=0; i < this.qwertyKeymap.length; i+=2) {
140+
this.setRow(i/2,this.LOWERCASE, this.qwertyKeymap[i]);
141+
this.setRow(i/2,this.UPPERCASE, this.qwertyKeymap[i+1]);
139142
}
140143
};
141144

142145
CKeyboard.prototype.setKeys = function(keymap){
146+
this.keymap = keymap;
143147
for (var i=0; i < keymap.length; i+=2) {
144148
this.setRow(i/2, this.LOWERCASE, keymap[i]);
145149
this.setRow(i/2, this.UPPERCASE, keymap[i+1]);
146150
}
147151
};
148152

153+
CKeyboard.prototype.calculateLearningCost = function(){
154+
this.learningCost = 0;
155+
var keymap = this.keymap;
156+
var qwertyKeyMap = this.qwertyKeymap;
157+
for(var i=0; i<qwertyKeyMap.length; i+=2){
158+
var qrow = qwertyKeyMap[i];
159+
for(var j=0; j<qrow.length; j++){
160+
var q = qrow[j];
161+
if(keymap[i][j] != q){
162+
// Check for swap
163+
var pos = this.locate(q);
164+
if(keymap[pos.y*2][pos.x] == q && this.qwertyKeymap[pos.y*2][pos.x] == keymap[i][j]){ // swapped
165+
this.learningCost++;
166+
}else{
167+
this.learningCost+=4;
168+
}
169+
}
170+
}
171+
}
172+
173+
return this.learningCost;
174+
}
175+
149176
CKeyboard.prototype.setupFingers = function() {
150177
var i=0;
151178
var fingers = [];

keystats.js

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function CKeyStats(name, keymap){
77
this.sameHandTotal = 0;
88
this.sameFingerTotal = 0;
99
this.keysTotal = 0;
10+
this.learningCost = 0;
1011

1112
this.rowTotal = [];// = new int[Keyboard.ROWS];
1213
this.lhTotal = []; //= new int[5]; //fingers on lh
@@ -22,6 +23,9 @@ CKeyStats.prototype.calculate = function(text){
2223
// reset counters
2324
var keyboard = this.keyboard;
2425
this.distanceTotal = this.sameHandTotal = this.sameFingerTotal = this.keysTotal = 0;
26+
if(this.name != "qwerty")
27+
this.learningCost = keyboard.calculateLearningCost();
28+
2529
var i=0;
2630
for (i=0; i < keyboard.ROWS; i++)
2731
{
@@ -103,6 +107,7 @@ CKeyStats.prototype.displayStats = function(resultsDiv) {
103107
var i=0;
104108

105109
resultsDiv.find(".totalKeys").text(this.keysTotal);
110+
resultsDiv.find(".learning-cost").text(this.learningCost);
106111

107112
// row percents
108113
// percent of non-space keys

0 commit comments

Comments
 (0)