Solve a Hidato puzzle: Difference between revisions

Content added Content deleted
(Added Kotlin)
m (→‎{{header|Perl 6}}: Add links to similar tasks)
Line 2,370: Line 2,370:


=={{header|Perl 6}}==
=={{header|Perl 6}}==
This uses a Warnsdorff solver, which cuts down the number of tries by more than a factor of six over the brute force approach. Rather than recalculating degree over and over, we maintain an array of known degrees for each node.
This uses a Warnsdorff solver, which cuts down the number of tries by more than a factor of six over the brute force approach. This same solver is used in:

* [[Solve a Hidato puzzle#Perl_6|Solve a Hidato puzzle]]
* [[Solve a Hopido puzzle#Perl_6|Solve a Hopido puzzle]]
* [[Solve a Holy Knight's tour#Perl_6|Solve a Holy Knight's tour]]
* [[Solve a Numbrix puzzle#Perl_6|Solve a Numbrix puzzle]]
* [[Solve the no connection puzzle#Perl_6|Solve the no connection puzzle]]


<lang perl6>my @adjacent = [-1, -1], [-1, 0], [-1, 1],
<lang perl6>my @adjacent = [-1, -1], [-1, 0], [-1, 1],