Solve a Numbrix puzzle: Difference between revisions

m
C# added a remark.
(Added C#)
m (C# added a remark.)
Line 368:
=={{header|C sharp}}==
The same solver can solve Hidato, Holy Knight's Tour, Hopido and Numbrix puzzles.<br/>
The input can be an array of strings if each cell is one character. AnyThe non-numericlength valueof indicatesthe afirst no-gorow must be the number of columns in the puzzle.<br/>
Any non-numeric value indicates a no-go.<br/>
If there are cells that require more characters, then a 2-dimensional array of ints must be used. Any number < 0 indicates a no-go.
<lang csharp>using System.Collections;
Line 380 ⟶ 381:
private static readonly (int dx, int dy)[]
//other puzzle types elided
knightMoves = {(1,-2),(2,-1),(2,1),(1,2),(-1,2),(-2,1),(-2,-1),(-1,-2)},
hopidoMoves = {(-3,0),(0,-3),(0,3),(3,0),(-2,-2),(-2,2),(2,-2),(2,2)},
hidatoMoves = {(1,0),(1,1),(0,1),(-1,1),(-1,0),(-1,-1),(0,-1),(1,-1)},
numbrixMoves = {(1,0),(0,1),(-1,0),(0,-1)};
 
196

edits