Much of the last few days has been spent in toying with data structures, and testing a few dozen hash functions for use with a simple hash table module. It’s actually the first time I’ve ever had to implement a hash table myself, lol. It’s a fairly simple creation built on top of chaining.

The perfect hungry mans analogy for those that know squat about data structures: let’s say you want to find a recipe for peanut butter cookies in a cook book. You could thumb through every couple pages of the book, looking for cookie recipes, or even flip over to the index in back, and depending on the quality of the index, hunt down by looking down the index and systematically checking all cookie references; linked lists and arrays more or less work similar. A hash table is more like a table of contents: you flip open the book, go to the ToC, and find the section with the cookie recipes, then flip to that page and start flipin’ every few pages until you find the one you want.

Hash tables work essentially the same way, you feed in the key (peanut butter cookies, yum), hash it down to an index to where you can find the target. Although hash functions that don’t collide (often enough to care) are possible, when you have to bind the generated index within a given size, the odds of several different keys sharing the same index skyrockets. So instead of a direct 1 to 1 mapping, you have a needle to which haystack mapping.

My implementation uses a dynamic array of bucket lists that are allocated with HashTableCreate(), each element is a list: every key is hashed then squashed down to the size. When a new key:value is inserted, it gets added to the bucket list. On look up, the key is hashed back to the same value in order to find the correct list, in which to hunt down the correct entry.

One reason I chose separate chaining, other then it fits with how my brain works; many schemes for open addressing (the alternative), feels more like something I would think up, in order to skip writing a hash table >_>. Although, I must admit the possibilities of  open addressing combined with quadratic probing are interesting; I’m more in favour of the chains. While I doubt my implementation is memory efficient—since the only two design goals were to be faster then a (pure) linear search and quick to hash out the code, it undoubtedly has it’s flaws. For the sake of testing how it effects the intended usage, I may try augment/replace the current behavior of prepending new entries to the lists with moving last requested keys to the head, or switch to using red-black trees in place of a linked list.

I spent several hours testing different hash functions, using a small input set of words and a larger system dictionary file for testing. HashTableCreate() allows one to specify which hash function should be used, and it’s possible to override with a user supplied one. In testing, I’ve found using hash functions created by people with a background in mathematics, works significantly better then my own, as duly expected lol. Other then dealing with hash function issues, the rest was a cake walk.

Of geeks and logs

Took it ‘easy’ yesterday, played some games and the only work that got done, was fairly light debugging / library installing / feature adding. Originally I planned to setup expat, libxml2, and libxslt under MinGW/MSVC, but called it a night after expat. Found an interesting thread on Daemon Forums, which shows either I really need to get a life, or a good nights sleep.

Grabbed a trio of cookies, put on the simpsons, and went to bed early, around 0100R; the easier solution :-o.

Had a fair bit of trouble getting to sleep as always, but being winded helps. By a quarter to 0700R, I had already woken up three times :-/. It was a half past noon when I finally got out of bed, not being disturbed makes for an interesting opportunity to sleep like a log and enjoy crazy dreams lol.

For my p resent activities, I’ve merely worke don importing my Live Journal entries from February 2009, into Blogger. I don’t think I’ll make my goal of having it all done before 2010 arrives, but alas, it will get done eventually!

Local time is reading 01:40R, so it seems that I’ve survived another Christmas on this rock. Much of the day, has really been spent trying to avoid the holiday altogether, for all practical intents and purposes. At least I got plenty of C code written for my games :-/.

The only real good thing out of the day, was a the ecard a friend sent—my one smile of the day.

It has been a some what hectic day, logged off around 0400R last night and couldn’t sleep, by the time I finally started to doze off, ma started shouting and jarred me awake again :-(.

Fast forward to like 0815 this morning and she does the same damn thing, I’ve had about 3 hours sleep, tops. Getting back to sleep is unbearable, improbable, and time passes slowly. Fast forward again, to about 1045R, and I’m thusly awoke again. In fact, by this point, I’ve had sooo little sleep, that I didn’t even realise that I was having a dream, until I was woken up! Went back to bed and finally got up sometime after 1200R, to be used yet again as a cheap slave…. I’m tired of being nothing more then an asset.

The only positive things so far, is I’ve had time (~1 hour) to play with my file server with only a half dozen interruptions or so. For me, that’s a blessing.

No idea what I’m going to do for the rest of the day, I’m not really in a good mood…. and there’s nothing much that I can get done right now, that is not going to result in headaches later. I fucking hate my life here.

I just had some fun :-D

Was walking to the mail box, and on the way back an older man asked if I was cold—like normal, I’m out in sandals, shorts, and T-shirt and it’s freezing cold out.

“Nope”
“Wow, you must be part escamo or something”
“I was born in Flordia, so I love it: beats 90 degrees!”

😀

****sigh****

Haven’t been updating my journal here lately, been to busy with work…. still 2 or 3 days of labour to deal with to boot.

Router has been giving me grief for at least two days, and previously was a power outage; I’m starting to think that the outage my have damaged the router somehow. If that’s the case, I am really fucked—because I can’t afford to replace the S.O.B.

Even worse, on top of that, I got up to cycle the router again and my finger hit my laptops power button while a port was upgrading, what a fsckin’ night!

If only I could …

My original plans for the night, was to be working on my games and setting up a test suite for the SAS project I’ve got on the side burner. However, since  being informed  Thursday that my Saturday was being taken *away*, I’ve been tasked with not staying up all night tonight: fat freaking chance of that. So instead of being up until 7 am working on code, I played a few hours of Quake Live, lol.

I expect that tomorrow is going to be a living hell anyway it’s sliced…. have to be used as a navcom so we can get to work, it’s likely to be to be on par with the worst job I ever had, and is in effect, a continuation of the second or third most utterly-exhausting-fml job I’ve ever had…. the kind you feel like you were dead when you get off work, instead of feeling like you’re dying. On the upside, I ought to get to see a few dogs that I haven’t seen in a while; which reminds me of a pair of sad memories[1][2].

One way or another, tomorrow is likely to be a wash out, of torture and getting nothing done. I’m already wishing it was Sunday…… !

Don’t feel like going to sleep, but if I don’t start snoring in the next 15 minutes, I’m not likely to be up tomorrow; would rather be having a snack. I know my body, and in all probability, I’m probably going to be awake for 2 or 3 more hours 🙁 🙁 :-(.

I’ve just posted a call for title/story ideas on [SAS], in the hopes of moving foreward with the TacFPSGame project and my toolkit for working on the Starfighter game.

Today I was reading an arcticle off /. and started to think…. gee, wouldn’t it be an interesting game idea: it started me to thinkin’ and combined with all the Quake Live I’ve been playing lately, get’s me back in the mood to work on game development lol. I really want the FPS to reflect my style of things: it should be fairly realistic in nature, but still a fun action game. Perhaps the original Rainbow Six or SWAT 3 are my strongest inspirations for the tactical elements, while Quake III and Urban Terror remind me of how much fun “Crazy off the wall” can get ;).

When it comes to the general game design and architecture, I know what I want both inside and out. It’s just the issue of having time to work on it. My primary loops at the moment, are working on EPI and some stuff for [SAS], but once that’s done, I’ll have plenty of time, in so far as my available coding time goes that is lol.

I’ve also elected, to start testing a conversion from C++ to Python. I originally elected C++ because it was the lowest common denominator for getting the best tools, and well, I can care less about having to deal with manual memory management. My reasons for contemplating the switch over, is because Python has largely become my standard utility language for cross platform stuff—and I would like to be able to play my games on my FreeBSD laptop!!! 90% of all heartaches have been due to differences between GNU Compiler Collection and Microsoft Visual C++. The most pissy problems being how they implement templates >_>. Ah, sweet, sweet C++, all your best features are also your biggest liabilities.

Most of what I’m interested in, is doing the game logic and stuff, I’m not willing to spend 6 months to 2 years writing a fourth rate rendering system when there is plenty of good open source code to draw upon. Yet, I’m not interested in being limited by most existing engines, like updated Id Tech 3 (Quake III: Arena), Blender-stuff, or the snazzy Unreal Engine 3 that was recently released. You could say, I don’t want an engine, I want a frame work :-/.

I was originally planning to integrate python for AI and level scripting tasks anyway, so big deal… it would become less problem to do it if everythings in Python anyway hehe.

That was a freaky moment… was sitting here writing a post to a mailing list over ggrps when the light/tv started to fade in and out. Did a quick ^A^C in the hopes that I might get the text copied to qlipboards file store, and flushed to disk before the system could fail…. no such look, an hours of typing gone: and I’m not rewriting it.

The strange thing, is it wasn’t a normal power outage, but more of a fluctuation. Part of the building went dead but part remained, on extremely low power, and I’m talking like a lamp making like it’s been given a 10 watt bulb lol. The best way I can describe it, is that it is as if the available power was tuned down waaaayyy low, and anything not able to compete for enough power started to shut off.

What is this, Republic of Turkey or something?

Dential update

Things went fairly well, saw the dentist on the 23rd and he proclaimed the problem after a short inspection, proclaimed it an abscessed tooth and infection causing the face to swell. He proscribed a choice of antibiotics, a heating pad, some pain killers, and a referral to a suitable dental surgeon.

According to Doctor Maddux, I should be fine in the short term as long as the swelling doesn’t interfere with my breathing (that was actually a comforting thought), but it can get serious enough that I could end up down the road at the hospital. Considering that my mothers bills over routine stuff totalled around $20,000—I have little interest in being admitted to a hospital, ready to keel the flug over! Our orders were to try and get the infection in check with the antibiotics and setup an appointment with the other office; and do so A.S.A.P. if things didn’t improve within a day or two.

Since I can sooner die in the middle of the street then see a $100 prescription filled for the heavy duty stuff, we went with the less effective but much more affordable antibiotics, which when subbed for the generics at the supermarket pharmacy, became 500mg tablets of Penicillin VK, of all things Penicillin lol. The last time I can remember hearing of Penicillin since WWII, was a pharmacist my mother once worked for long before I was born, who, or so she had told me years ago, used to give out pills of it to poor coloured in the hopes of curbing syphilis; although I’m not quite sure if that was even legal back then >_>. But hey, when the price difference in what the Dentist is prescribing is like $90~$100+ atomic bomb versus a $0 gamble that it might work… it’s worth a shot, isn’t it?

Borrowed a heating pad, but didn’t put it to much use. Willow trying to climb on top of it, and pushing a heating coil into my face made it clear that it would be a bad idea; reverted back to a wash cloth, and for the first time in my life was glad the kitchen sink can output burning hot water liquidy split. Either way, I found the heat on my left cheek very soothing.

For good measure, the Dentist proscribed a small supply of mild pain killers for use `as needed`, which when filled in for by generics, is a smidge of Hydrocodone and a hefty shot of acetaminophen/paracetamol (better known to most of us in the USA, generically as Tylenol, even though that’s actually a brand name not a substance lol). I’m not like the average American, who takes a pill for anything. For me to even take two Tylenol over a headache or toothache, means I’m probably ready to smash my head through a wall because of the pain. Throw the other crap in the mix and yeah, I’m not inclined to take it unless absolutely necessary. Life’s given me a nice threshold against pain anyway… so as long as I’m able to sleep, usually not much to worry about.

Spent a about 20-30 minutes walking around the supermarket while the prescriptions were being filled, my tooth was agonising and the left side of my jaw looked like I had cotton balls stuffed between my choppers and cheek. But on the upside, by the time we got to the checkout most of the pain subsided for a couple hours. Took the first dose of antibiotics in the car and noted that the pharmacists directions said that this Penicillin is better absorbed on an empty stomach—perfect for me.

Refused my mothers attempts to push food my way at every opportunity; hopped on the computer to check in with a friend on AIM, then hit the Proving Grounds for a couple. Soon gave up on playing SWAT 4, and laid down with the heating pad. I just crashed on the bed for a few hours, ended up napping with my head at the foot of the bed, cover drapped over me, and the dog near my feet.

Seems that the Penicillins only adverse effects on me have been causing me to feel cold, chilly at times I guess; but that is basically it. Woke up around 1800-something and had a bowl of soup with some cold meatloaf for dunkin’ for dinner; the hot broth was just what I needed. Having *officially* declared war on this S.O.B. of a tooth and infection, I inspected the problematic tooth with a tooth pick eariler, and flossed / brushed my teeth after dinner, plus rinsed out with mouthwash before bed.

After finishing my meal and brushing with a militaristic determination (lol, don’t ask), I settled down on the couch for a good nap: and focused every fibre in me towards kicking this thing to the curb. Woke up in time for the second dose of antibiotics and another short nap. By the time I got up to go to bed, I no longer had a toothach—much appreciated.

By morning most of the swelling went down, but if I place my hand to my face, I can still feel the buldge on the left. So far, so good, and I’ve not had any serious pain since before the second Penicillin pill. Managed to get to work this morning feeling pretty normal.

Have the appointment for next Tuesday programmed into my Calendar, and hopefully will be rid of this damaged, deranged, bastard of a tooth as soon as we can figure out how to pay for it… and hopefully any part of this infection will be K.I.A. by then.