table three knightstours what abstractions can now be made from this examplewhich pattern does it exhibit that is typical for this kind of problem-solving algorithmswhat does it teach usthe characteristic feature is that steps toward the total solution are attempted and recorded that may later be taken back and erased in the recordings when it is discovered that the step does not possibly lead to the total solutionthat the step leads into dead-end street this action is called backtracking the general pattern below is derived from trynextmoveassuming that the number of potential candidates in each step is finite procedure trybegin if solution incomplete then initialize selection of candidates and choose the first onewhile ~(no more candidates~canbedone(candidatedo select next end end end tryprocedure canbedone (move)booleanbegin record movetryif not successful then cancel recording endreturn successful end canbedone actual programs mayof courseassume various derivative forms of this schema in particularthe way input is passed to trynextmove may vary depending on the problem specifics indeedthis procedure accesses global variables in order to record the solutionand those variables containin principlea complete information about the current state of the construction process for instancein the knight' tour problem trynextmove needs to know the knight' last position on the boardwhich can be found by search in the matrix howeverthis information is explicitly available when the procedure is calledand it is simpler to pass it via parameters in subsequent examples we will see variations on this theme