Solve a Numbrix puzzle: Difference between revisions

{{Out}}
(unneeded variables deleted!)
({{Out}})
Line 1:
{{task}}
Numbrix puzzles are similar to [[Solve a Hidato puzzle|Hidato]].
Numbrix puzzles are similar to [[Solve a Hidato puzzle|Hidato]]. The most important difference is that it is only possible to move 1 node left, right, up, or down (sometimes referred to as the [[wp:Von Neumann neighborhood|Von Neumann neighborhood]]). Published puzzles also tend not to have holes in the grid and may not always indicate the end node. Two examples follow:
Published puzzles also tend not to have holes in the grid and may not always indicate the end node.
Two examples follow:
 
;Example 1
Line 53 ⟶ 56:
</pre>
;Task
Write a program to solve puzzles of this ilk, demonstrating your program by solving the above examples. Extra credit for other interesting examples.
demonstrating your program by solving the above examples.
Extra credit for other interesting examples.
 
RealatedRelated Tasks:
* [[Solve a Hidato puzzle]]
* [[Solve a Holy Knight's tour]]
Line 219 ⟶ 224:
}
</lang>
{{Out}}
Output:
<pre>
49 50 51 52 53 54 75 76 81
Line 346 ⟶ 351:
end</lang>
 
{{Out}}Sample runs:
<pre>
->numbrix <numbrix1.in
Line 676 ⟶ 681:
end /*r*/
say; return</lang>
'''output'''{{Out}} when using the input of:<br>
<br><tt> 1 1 . . . . . . . . ./2 1 . . 24 21 . 1 2 . ./3 1 . 18 . . 11 . . 64 ./4 1 . 17 . . . . . 67 ./5 1 . . 33 . . . 59 . ./6 1 . 35 . . . . . 71 ./7 1 . 38 . . 43 . . 78 ./8 1 . . 46 45 . 55 74 . ./9 1 . . . . . . . . . </tt>
<pre>
. . . . . . . . .
Line 702 ⟶ 707:
27 26 23 22 9 8 7 6 5
</pre>
'''output'''{{Out}} when using the input of:<br>
<br><tt> 1 1 . . . . . . . . .\2 1 . 43 44 47 48 51 76 77 .\3 1 . 38 . . . . . 72 .\4 1 . 37 . 1 . . . 73 .\5 1 . 32 . . . . . 56 .\6 1 . 33 . . . . . 57 .\7 1 . 6 . . . . . 60 .\8 1 . 11 12 15 18 21 62 61 .\9 1 . . . . . . . . . </tt>
<pre>
. . . . . . . . .
Anonymous user