Friday, February 03, 2006

www.godpatterns.com

I've registered a name. I've been thinking about making the move to a more freeing web prescence for a while. I love blogger but it would be nice to be able to have non-blog data, articles, source code and the like.

So that's cool. I'm actually hoping to pay nothing at all, not directly anyway. Adsense produces a very small trickle of money and with a generous $4 that I stumped up I registered the domain for a while. (It seems most com names are quite quite gone, I would have quite liked EIN, I'd thought of clockworkworlds for a while and until just recently it was free, but that's too long. CWW was also registered, as I assume nearly every three letter domain is. funkmanor is still free, as is megagermany and forthegloryofprussia, but I wanted something I could potential sell or distribute games from in the distant hazy future.)

But I've not just been frittering away advertisement dollars - oh no - I've been tackling thorny issue and rasing my code-foo.

Basically I wanted (among other things) to implement the old tab-complete thing. You press tab and it checks what possible words you could be writting and finishes it. Also control-space in VS.net - one of the bestest shortcuts ever. I didn't want to do it by going through a list of words and attempting to match them - that's like exponential complexity, no I wanted a tree!

So let's say we have the commands PRINT and PAUSE, the tree would look like:



P
/ x R
/ A I
/ \ x U N
\ S T
\ E x


Then if we typed PR and pressed TAB it would finish PRINT, well that's all very nic but I wanted more. The tree should be dynamic! I should be able to add words on the fly, ( at this point there's no way to remove them) and not only add them on the fly but the tree should auto-balance itself so that the most common words are the one's accessed first! For instance if we have PRINT, PAUSE, PARTY then it the tree would start P -YES-> A not P -YES-> R, because there's more chance of it being A, assuming the commands are used equally (not something I really desire to get into). So yes weighting goes in there as well, weighting and auto-sorting.

Anyhoo I'll probably post the code tomorrow. It's basically just a binary tree with weighted nodes, or something like an Adaptive Hoffman Tree. It only deals in strings but if I made it generic then it could predict likely orders of anything . . . though I can't really thing of what these other things might be at the moment.

Also I'm a year older and it's the traditional end of winter in Japan. For these reasons this weekend may result in a slump in productivity.
Post a Comment