while(newpiece != NULL) {if(newpiece->hashvalue == hashvalue) { int i, j;for(i = 0; i < WIDTH; i++) {for(j = 0; j < HEIGHT; j++) {if(convert[(int)config[j][i]] != convert[(int)newpiece->pieces[j][i]])gotonomatch; } }return0; } nomatch: newpiece = newpiece->next; }

Node number-level 110 69 Node number-level 111 50 Node number-level 112 31 Node number-level 113 16 Node number-level 114 5 Node number-level 115 1 Node number-level 116 0 116 moves to complete! solvePuzzle number of elements is 23903

This is the ongoing analysis of glpuzzle from FLTK. It does have something to do with the "Traveling Salesman Problem" TSP and I was wrong about the tree being generated. The above code makes a matrix, which stops on a solution and back tracks to the origin. There are many interesting aspects to this problem and I have developed some unique ways to display and analyze the matrix of solutions. I am extending it to go past the first solution so that I can see how many paths are dead ends, loops, and the degree of loop between various points. It also relates to the graph problem as there are paths that can be taken and some that cannot. So it does deal with topology and sets and the nature of solutions themselves.

I don't have a complete grasp of the real scope of this and how it relates to other solved situations, but I do know that I am learning a lot about logic itself in the process. I approach it for a few minutes each day and extend my understanding to encompass new aspects.

I'm not so sure I like the "goto", but this wasn't intended to be gospel code it is just a test for FLTK. It really is very good code generally, and very readable.

## 0 comments:

Post a Comment