Friday, June 27, 2008

Senior Project 2: 313(7|2|( |30064100

So, before I left the college campus, I pounded out some code that at the time I thought would basically complete my Senior Project and then left it for a while. Naturally, it doesn't work, and I have no idea why. I went through and added several things at once without testing to make sure each step needed to work before it proceeded to the next step actually worked. This is a terrible way to do things. It's such a mess that just starting over would be faster and easier than sorting through whatever the hell I shat out before I left campus.

For once, I'm going to plan this out. I'm going to do it here on my blog, primarily so I'll be able to get back to it easily across different computers. Also, in case some sort of master programmer reads my blog because s/he is really bored and wants to drop me a few pointers.

The basic goal of this project is to alter a circuit simulation program so that when a gate or object of any type is moved, any wires in any of the pins said gate or object is attached to are re-routed such that the connections are maintained. I intend to do this using an A* search, which I must now implement from scratch. It should flow something like this.

1: Identify the wire that is being re-routed; where does it START, and where should it now END?
2: Generate a wire that both begins and ends at START, from which all future wire possibilities (WIRESET) will be generated. This will be designated as BEST to begin with.
BEGIN loop 1
3: Check to see if the current BEST wire makes the connection from START to END.
4: Put best into USEDSET, which will record every wire that has already been checked in the past.
5a: If not, generate each wire that has an end location that is one unit (this program works with a grid) away from the current state in each direction. Up, Down, Left, Right.
5b: If yes, goto 9.
6: Check to make sure each wire generated in 4a is not already in USEDSET. If it is, discard it. Otherwise, add it to WIRESET.
7: Evaluate each wire currently in WIRESET using a heuristic (elaborated upon later, perhaps), and choose the wire that is closest to the END state. This step is a procedure unto itself and will require further elaboration later. In the beginning, a random number will be assigned to each wire so that the rest of the process can be debugged.
8: goto 3
END loop 1
9: Return current BEST

For debugging purposes, I will limit loop 1 to iterating a number of times that I as a human could actually manage myself--let's say five for now, maybe more maybe less when I actually try it--so that I can make sure that step 5 and 6 are working properly.

I foresee step 7 being where all the problems happen, and I may make another post like this one to help me think about how that one will flow.

I've about a month and a half to finish this. If I really sit down and go at it (and nothing explodes in a particularly terrible way), I can do it in a week. I also have to write a paper about it, though, and it needs to be a damned good paper. If I pound at that, I can do it in a day or two. So, my goal is to have the implementation part completely done by the end of July.

Any of my friends who actually read my blog: hound me about it. Seriously. I still feel no pressure to get this done, and I don't work well without pressure.