Anonymous user
Solve the no connection puzzle: Difference between revisions
m
→{{header|Java}}: small changes
(→{{header|Java}}: using prefined connections like the Go example is more convenient) |
m (→{{header|Java}}: small changes) |
||
Line 727:
// adopted from Go
static int[][]
{2, 3, 4}, // A to C,D,E
{3, 4, 5}, // B to D,E,F
{2, 4}, // D to C, E
{5}, // E to F
{2, 3, 4}, // G to C,D,E
{3, 4, 5}, // H to D,E,F
Line 740:
public static void main(String[] args) {
List<Integer>
do {
Collections.shuffle(
for (int i = 0; i < pegs.length; i++)
pegs[i] =
} while (!solved());
Line 752:
static boolean solved() {
for (int i = 0; i <
for (int peg :
if (abs(pegs[i] - peg) == 1)
return false;
|