Showing posts with label My Progs: (Optimization Algorithm). Show all posts
Showing posts with label My Progs: (Optimization Algorithm). Show all posts

Thursday, November 20, 2008

Long absence (or: my news)

I am sorry for not posting during the last months but I was quite busy. I had to do some projects for my university; this is a quite exciting year. :-P Perhaps the most interesting project of them is the one for Microcomputers: Along with my partner we decided to make a PIC based Morse decoder, decoding Morse from it's microphone and displaying characters on an LCD. Well we still have problems making the PIC programmer which for some reason doesn't work.

I also work on another program that produces an exam period schedule based on what subjects each student will take an exam on, so that students have enough days between the subjects to study. It works very well but, although it scales linearly, I find it quite slow for big input data, roughly estimating that it will need 2 days to optimize the exam schedule for a school of 3000 students. So I am still working on improving it's speed. I will post this program here when I finish it.

I am also rewriting AskWise from the scratch. It will be a menu driven console program and I hope that I won't consider it a beta anymore when it's finished.

Finally I was going to rewrite for the new Intrepid Ibex my old Vaio & Hardy Heron how-to but I don't have to, since Shawe wrote an excellent how to. It is in Spanish but you can easily understand it even without translating it.

So I guess my next post will be in less than a month. :-)
Have fun.

Friday, May 23, 2008

Game of Life

It's been some time since my last post. Since then many things happened. Well in fact just one serious thing: my laptop's HD has been fried... :-( At the same time I fell in love with Ubuntu Live CD which I've been using for the past 5 days...

I went to some stores but I couldn't find any IDE HD with more than 80GB capacity, so I'll wait one more day for their supplies to arrive. One of the salesmen told me that they "might" get some IDEs for laptops this Friday. >:-(

Anyway. Today I made a nice little prog that calculates a possible state in Game of Life that will evolve into a specific state after one step. I'm too tired to explain more about the Game of Life so try wikipedia. :-)

Here's what I made with it:

# ## ## # # #
# #
#### #### ##### #### ########### ###########
## # # # # # # # # #
### # # ## #### # # # # #
##### ## ## ## ####### # #
# # # ## ###### # ### # #
# # # ## ## ## ## # #
## ### # ### ##### # # ## #
# # # # ## ## # ## # # # # #
# ## # # # # # ## # # # # #
### # # ##### ### ### # ## #
## ## # ## ### # ### # # ## #
### ### # # ## # # # # #
#### # # ### # ## # # # # #
# ### ######## ######
# # # ##### ####### ## #


To the left is the first state which evolves into what you see to the right. (TrT stands for Tritonio). I simply gave the right state to the program and it calculated the left one. The script uses an algorithm similar to the one I used while making my keyboard.

I am trying to make an "INSHAME" logo right now but, if at all possible, it will take much time due to it's size.

If you are really curious you can find the Lua source code of the program here but it's undocumented, written in the past three hours, and geek-only. ;-)

UPDATE:

Finally the Logo has finished!!!!!!! Here it is!!!


# # ## ## # # # # ## # # # # ##
# # # # # #
### ### ### ##### ## ## ## # # #
## # #### # #### # # # ### # # # ####
# # # # # ## # # ### # # ## # #
## # ## # ## # ### # # ## # # # #
## # # ### # ##### # # #### ##
## ## # ## # # # ## # # ###
# # # # #### # #### ### ##
# ### # # ## # ### # # # ### #### ## #
# # # # # # # ## # ##
# # # # # # ## # # ## # #

This evolves into INSHAME! :-D
I am still improving the algorithm.

Saturday, November 17, 2007

Easy Keyboard Layout

The QWERTY keyboard layout (the one that you probably use every day) was made mainly to avoid stuck pairs of typebars in typewriters. Of course this is not a problem with modern keyboards and that makes the QWERTY layout a bit inefficient (at least for the right handed people). For example many words can be typed by using only the left hand while there are fewer that can be typed with the right hand only. The best case would be to have both hands type alternating keystrokes so that you can move one hand in place while you are striking a key with the other.

There are other keyboard layouts too which try to address some of these problems. One the most famous is the Dvorak keyboard which is probably better than QWERTY.

Anyway, to cut a long story sort, I wrote, before one or two days, a program in Lua that would try to make an optimized layout based on three criteria:
  1. Letters that appear next to each other often in English text should be far from each other on the keyboard so that the two hands can press them alternatively.
  2. Characters that appear often with a distance of two characters (like T and E in the word "the") should be close to each other so that that each hand moves as less as it is possible during the alternations.
  3. The most used character should be close to either the third or the seventh key of the second row (where the D and the J lie on QWERTY keyboards) because that's where I put my middle fingers. :-P
I run this program with LuaJIT (because I really needed more speed) and it came up with this layout:

Z V M L W D A I G Q
X H N R S T E O K
J U C F Y P B

Today I bought a keyboard (the cheapest I could find) and started switching the positions of the keys to turn it into this:
(the photo is outdated. The P and B should be switched)
I still haven't tested it because I bought a PS/2 keyboard while my laptop hasn't got a PS/2 port. So I am waiting to test it to a friend's PC tomorrow.

Of course to use this keyboard you will need to notify the system of the different letter positions. I made a file that can be loaded with xmodmap in Linux to use this keyboard. I will also do the same with Microsoft Keyboard Layout Creator so that Windows will be able to recognize my layout.

I won't upload the program's code yet because I am constantly changing it. If you really want it then just leave a comment asking for it and I will upload it. You might also want to try Kiwi: a program written in C that will create custom keyboard layouts. It looks like a great program but I haven't actually tested it yet.

Amazing fact: Just by changing the position of the letters on a keyboard you can create more than 403,291,461,126,605,635,584,000,000 different layouts.

Popular Posts