Wednesday, January 16, 2013

Loop identification - IV

An error in the previous code. The code fails with certain types of circuits. This is why:

I don't move right except after the first element after the diagonal. This is OK as long as I cover all elements with each movement. That is when I am moving down, all existing elements must be covered. When left, and up also. But I am only touching the nearest element. Which will only work when the loops connect the closest nodes together.

So, the code will have to be rewritten and significantly. The logic will be:

1. Start from the first element after the diagonal. Check how many elements exist in that row and create that many lists with these two elements.

2. For each of these lists, look "down" and see how many elements exist in that column. Create those many copies of the original list with three elements now and so on.

3. The termination condition will be is a loop is found or if no other element is found.

This will need repeated copies of lists.

No comments:

Post a Comment