Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
semi committed Jul 2, 2021
1 parent 1b1c514 commit 8925bf2
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 17 deletions.
Binary file removed cpu.prof
Binary file not shown.
2 changes: 1 addition & 1 deletion data.json

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,27 @@ func Score(l Layout) float64 {

weighted, highest, _ := WeightedSpeed(speeds)

score += 2*weighted
score += 3*weighted
score += 2*highest

tri := FastTrigrams(l, 300)
tri := FastTrigrams(l, 100)

score += 0.1*(100-(100*float64(tri[0]) / float64(tri[4])))
score += 0.03*(100-(100*float64(tri[0]) / float64(tri[4])))
score += 0.3*(100*float64(tri[3]) / float64(tri[4]))
//score += 10*(100-(100*float64(tri[1]) / float64(tri[4])))
left, right := IndexUsage(l.Keys)

score += 0.5*math.Abs(right-left)
score += 0.5*math.Abs(11-right)
score += 0.5*math.Abs(11-left)
score += 0.1*math.Abs(right-left)

return score
}

func randomLayout() string {
if ImproveFlag != "" {
return strings.Join(Layouts[ImproveFlag].Keys, "")
}
//return strings.Join(Layouts[ImproveFlag].Keys, "07.a2")
}
chars := "abcdefghijklmnopqrstuvwxyz,./'"
length := len(chars)
var l string
Expand Down Expand Up @@ -293,9 +297,9 @@ func Anneal(l *Layout) {
func swapRandKeys(l Layout, count int) Layout {
var possibilities []int
//if ImproveFlag != "" {
//possibilities = []int{1,2,3,4,5,6,7,8,9,14,15,17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29}
possibilities = []int{0, 1,2,3,4,5,6,7,8,9,14,15,16,17,20, 21, 22, 23, 24, 25, 26, 27, 28, 29}
//} else {
possibilities = []int{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}
possibilities = []int{0, 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}
//}
length := len(possibilities)
for i := 0; i < count; i++ {
Expand Down
Binary file removed genkey.test
Binary file not shown.
Binary file removed heatmap.png
Binary file not shown.
5 changes: 3 additions & 2 deletions layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func FingerSpeed(l []string) []float64 {

if SlideFlag && dist <= 1 {
if pair[1] > pair[0] {
speed[f] += 0.01+(float64(dsfb)*0.5*dist)
speed[f] += 0.02+(float64(dsfb)*0.5*dist)
continue
}
}
Expand Down Expand Up @@ -297,6 +297,8 @@ func FastTrigrams (l Layout, precision int) [5]int {
f2 := finger(l.Keymap[string(tg.Bigram[1])])
f3 := finger(l.Keymap[string(tg.Bigram[2])])

total += int(tg.Count)

if f1 != f2 && f2 != f3 {
h1 := (f1 >= 4)
h2 := (f2 >= 4)
Expand All @@ -321,7 +323,6 @@ func FastTrigrams (l Layout, precision int) [5]int {
//fmt.Println(tg.Bigram, "roll")
}

total += int(tg.Count)
}
}

Expand Down
13 changes: 9 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {
}
}
GeneratePositions()
KPS = []float64{1.0, 4.0, 4.8, 5.6, 5.6, 4.8, 4.0, 1.0}
KPS = []float64{1.0, 4.0, 4.8, 5.7, 5.7, 4.8, 4.0, 1.0}
//KPS = []float64{6, 16, 26.5, 40.36, 40.36, 26.5, 16, 6}
//KPS = []float64{1, 3, 6, 8, 8, 6, 3, 1}
//KPS = []float64{1, 1, 1, 1, 1, 1, 1, 1}
Expand Down Expand Up @@ -77,13 +77,18 @@ func main() {
Layouts["0.4"] = NewLayout("0.4", "ymlkjqfau,scrtdbnoeixw'gvph/z.")
Layouts["0.5"] = NewLayout("0.5", "yluwqkfha.sredcmtnoixj'gpzvb/,")
Layouts["0.6"] = NewLayout("0.6", ".yuwfqzalvisedcmnort/x,gpbh'jk") // -rolling, +index balance
Layouts["semimak"] = NewLayout("Semimak", "yhavzqwulfinotkcders/b.mjpg,'x")
Layouts["0.7"] = NewLayout("0.7", "yhavzqwulfinotkcders/b.mjpg,'x")
Layouts["0.7a"] = NewLayout("0.7a", "yauvzqwhlfioetkcdnrs/.,mjpgb'x")
Layouts["0.7a3"] = NewLayout("0.7a3", "ylhvzqwuofirntkcdeas/'bmjpg,.x")
Layouts["a"] = NewLayout("a", "yauwbxkclvioenpdhsrtj/,.qfmg'z")
Layouts["1.0"] = NewLayout("1.0", "flhvzqwuoysrntkcdeaix'bmjpg,./")
Layouts["1,0"] = NewLayout("1,0", "flhvzqwuoysrntkcdeaix'bmjpg/.,")
// Layouts["0.7mv"] = NewLayout("0.7mv", "yhamzqwulfinotkcders/b.vjpg,'x")
// Layouts["0.7idk"] = NewLayout("0.7idk", "yhamkqwulfinotvcders/b.jzpg,'x")

Layouts["whorf"] = NewLayout("Whorf", "flhdmvwou,srntkgyaeixjbzqpc';.")
Layouts["strtyp"] = NewLayout("strtyp", "jyuozkdlcwhiea,gtnsr'x/.qpbmfv")

// Layouts["flaw"] = "flawpzkur/hsoycmtenibj'gvqd.x,"
// Layouts["beakl"] = "qyouxgcrfzkhea.dstnbj/,i'wmlpv"
// Layouts["owomak"] = "qwfpbjluy;arstdhneioxvcbzkm,./"
Expand Down
4 changes: 2 additions & 2 deletions output.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func PrintAnalysis(l Layout) {
PrintLayout(l.Keys)
k := l.Keys
//tri := Trigrams(k)
ftri := FastTrigrams(l, 1000)
ftri := FastTrigrams(l, 500)
//total := float64(Data.Total)
ftotal := float64(ftri[4])
//fmt.Printf("Rolls: %.2f%%\n", float64(100*Rolls(k)) / total)
Expand Down Expand Up @@ -63,7 +63,7 @@ func PrintAnalysis(l Layout) {
fmt.Printf("Highest Speed (weighted): %.2f (%s)\n", highestWeighted, highestWeightedFinger)
fmt.Printf("Highest Speed (unweighted): %.2f (%s)\n", highestUnweighted, highestUnweightedFinger)
left, right := IndexUsage(l.Keys)
fmt.Printf("%.1f%% %1.f%%\n", left, right)
fmt.Printf("Index Usage: %.1f%% %1.f%%\n", left, right)
fmt.Printf("SFBs: %.3f%%\n", 100*float64(SFBs(k))/float64(Data.TotalBigrams))
fmt.Printf("DSFBs: %.3f%%\n", 100*float64(DSFBs(k))/float64(Data.TotalBigrams))
dynamic, _ := SFBsMinusTop(k)
Expand Down

0 comments on commit 8925bf2

Please sign in to comment.