Philosophical Multicore

Sometimes controversial, sometimes fallacious, sometimes thought-provoking, and always fun.

New Keyboard Layout Project: New Results

Posted by Michael Dickens on September 1, 2009

After fixing the bug, I modified the program and got a rather different (though good) result.

; g u c b  x h p w .
a t e s d  l n i r o
' v y f z  j m , k q

Fitness:       20.38
Distance:      7814.03
Inward rolls:  7.59%
Outward rolls: 5.49%
Same hand:     22.26%
Same finger:   0.77%
Row change:    9.10%
Home jump:     0.39%
To center:     3.55%

This layout has nice inward rolls and great same finger and distance. It has pretty low usage of the right middle finger, though, and pretty high usage of the left ring finger. Other than that, though, it’s very nice.

Also, I added a function to my program that shows what the easiest and hardest digraphs are. The theory is that more common digraphs should be easier. For this layout, the easiest digraphs are in, es, te, and ri. The hardest are ‘;, ‘a and uy. You can see why ‘; is so hard: it involves jumping over the home row on the same finger to hit two of the hardest spots.

And here’s the source code, if you want to check it out.


13 Responses to “New Keyboard Layout Project: New Results”

  1. phynnboi said

    Ah, the code. I’ll let you know if I come up with anything interesting. (Being intentionally vague, here.)

  2. phynnboi said

    I couldn’t get it to compile with Watcom and I don’t have easy access to gcc. Oh well.


      Does that not work for you?

    • Bill said

      @Phynnboi To run gcc on Windows you’ll probably need to install cygwin. I had never heard of Watcom before. I’m curious, what errors does it give you?

      • phynnboi said

        Well, the first errors were because the source files have the .c extension, but use C++ syntax*. So, I changed them all to .cpp files. Then, I didn’t have (I think), so I hacked out most of that code (it’s irrelevant to what I’m doing, anyway). Then, there were issues with being unable to declare static array sizes using variables. I hacked those away. Then, there were a crap-ton of linker errors and by that time I was so tired of fighting with the code that I just gave up.

        I don’t want to have to go through the rigamarole of installing cygwin and gcc just for this, since I’m otherwise quite happy with Watcom. I may try uploading it to my old school account and seeing if I can compile it there–they have gcc.

        * Or is it C with gcc-specific extensions? Whatever it is, it’s not C89 compliant.

      • phynnboi said

        That should say, “Then I didn’t have sys/time.h (I think)….” I forgot this thing parses angle brackets.

      • Bill said

        I believe that syntax is actually C99. If I use the C89 flag I get lots of errors. It looks like Watcom has incomplete C99 compliance and you’d need to turn that on using the -za99 flag.

        is a Unix thing I think so it’s probably not available on Windows.

        This is first time I tried to compile it from the command line in Mac OS X (I was using the Xcode IDE) and there are warnings but it does compile.

      • phynnboi said

        Alright, that seems to have done it, although there were several hundred linker warnings.

        I was mostly interested in dropping in my simulated annealing-type algorithm in place of Michael’s genetic algorithm and seeing how it did. Here’s a sample output:

        , y c d b x l u w .
        a i s t g h n e r o
        q ' f p j v m ; k z

        Fitness: 2387397
        Distance: 2099974
        Inward rolls: -202695
        Outward rolls: -10614
        Same hand: 88576
        Same finger: 164155
        Row change: 144671
        Home jump: 29040
        To center: 74290

        Evaluation: 2387397

        Time elapsed: 0 hours, 0 minutes, 3 seconds

        I’m doing a run with Michael’s genetic algorithm at the moment. It will be interesting to compare the results.

      • Bill said

        Oops, I see in my previous post it lost part of my sentence due to the angle brackets. I should have read:

        <sys/time.h> is a Unix thing I think so it’s probably not available on Windows.

  3. I added a new version. (You can get it at the same URL.) This version has more easily readable output for the Final Best Keyboard output.

  4. phynnboi said

    From my run with Michael’s genetic algorithm:

    . y h c b x l u g ,
    o i n s d m r e t a
    q ' p f j k w ; v z

    Fitness: 2324530
    Distance: 2110406
    Inward rolls: -184575
    Outward rolls: -9513
    Same hand: 84674
    Same finger: 111955
    Row change: 130453
    Home jump: 18470
    To center: 62660

    Time elapsed: 0 hours, 18 minutes, 10 seconds

    From a run of my simulated annealing-type thingy:

    , y u c b x l d p .
    a i e s f h r t n o
    ; j ' w z k m g v q

    Fitness: 2322457
    Distance: 2104697
    Inward rolls: -178890
    Outward rolls: -5839
    Same hand: 73096
    Same finger: 108160
    Row change: 112183
    Home jump: 39960
    To center: 69090

    Time elapsed: 0 hours, 1 minutes, 34 seconds

    It’d actually found a fitness 2324944 layout by 34 seconds.

    Anyway, I just wanted to compare algorithms. It seems they produce comparable results, although the simulated annealing approach is much faster.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: