Although I still believe that the old algorithm would indeed work, a new plan must be considered. Looking at the plan with the knowledge that this algorithm needs to implemented with larger tracks leads me to believe that a new algorithm needs to be explored. This algorithm may be best to stop collisions, but it does not handle small sections of track with only connecting only photocells. Recently, I visited with each of the CS faculty to discuss a new algorithm
Dr. Pankratz recommended that we use a similar idea, but take into account the type of data structure that we will be hitting next. This type of idea will work I think, but he recommended that there be buffer zones that once a train passes there is no turning back. I didn’t know exactly how this could be done, since the only place I know is where a photocell triggers a response from the computer.
Professor Blanik and Dr. McVey both recommended the use of a graph represented a hash table (array of linked lists) with each photocell and turnout representing each node. At first I also had similar problems with this algorithm stating that we could not use the turnouts since I still do not know when the train moves over them. I thought that new photocells would need to be installed, but then I thought that we could allocate all resources needed between photocells. That is hash to the photocell and find the next resource. If it is a turnout follow that list to find the next resource. Keep going until the next photocell is found. Allocate all of these resources and deallocate them when that next photocell is hit. One problem with this logic is that trains could possibly hit each other in sections that contain only two photocells since there is no buffer. Also there is no guarantee that the train that needs the resource next will be the one that triggers the next photocell.