Weird Accidental Skills

In life, we wind up with accidental skills in the course of doing things that we want to do.
We didn’t necessarily go out to learn whatever the something was.

For one example, I generally dislike IT work (installing software, OSs, drivers, various productivity applications, etc).

I don’t like doing it, but in the course of what I do, I have had to learn these things because NOT having them done was getting in the way of what I was trying to do.

In the type of games that I write, I often find myself faced with a set of nodes arranged in a rectangle, and the nodes can interconnect in an orthogonal way.

Translation: I deal with square grids with non-diagonal connections between the cells.

I long ago realized that each connection from a cell can be represented by a single bit that is 1 if the connection is there, and 0 if it is not.

I also started almost as long ago in thinking of the directions as starting with “north” (for me, “north” == towards the top of the screen), and rotating clockwise.

So my directions are north(up), east(right), south(down), and west(left) in that order.

My bits are also in that order, from low to high.

North is bit 0, east is bit 1, south is bit 2, west is bit 3.

The values for interconnected cells, therefore, can all be represented by 4 bits, or the values 0 through 15.

Here’s the accidental skill.

You give me a number 0 – 15, and I can almost instantly tell you which of the categories (dead end, elbow, straight, “T”, or crossway), and most likely  describe to you what ways it connects.

I’m a *LITTLE* slower on 11, 13, and 14, because I have to subtract from 15 and tell you what connection *ISNT* there rather than tell you what connections *ARE* there.

I can also tell you what the value of that cell would be rotate clockwise or counterclockwise, because rotations deal with shifting bits and moving either a carry or borrow bit as necessary.

For example, a cell with a value of 7 (a “T” with every value but west), when turned clockwise will be 14 (no need to carry any bits), and when turned counterclockwise will give 11 (because 7/2 = 3.5, so drop the .5 and add 8).

It is a goofy bit of engrained knowledge that I carry, and its only because I work so much with mazes.


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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