Solve the no connection puzzle: Difference between revisions

Content added Content deleted
m (→‎{{header|Java}}: small changes)
m (→‎{{header|Java}}: added comment)
Line 717: Line 717:


=={{header|Java}}==
=={{header|Java}}==
The backtracking is getting tiresome, we'll try a stochastic solution for a change.
The backtracking is getting tiresome, we'll try a stochastic solution for a change.<br>
{{works with|Java|8}}
{{works with|Java|8}}
<lang java>import static java.lang.Math.abs;
<lang java>import static java.lang.Math.abs;
Line 765: Line 765:
}
}
}</lang>
}</lang>
(takes about 500 shuffles on average)
<pre> 4 5
<pre> 4 5
2 8 1 7
2 8 1 7