All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Jumping Coins (Posted on 2004-10-18)
There are 10 coins laid out on a table in a straight line
```* * * * * * * * * *
1 2 3 4 5 6 7 8 9 10
```
The goal is to get 5 stacks of 2 coins each in only 5 jumps.
A coin must jump over exactly 2 other coins and land on a third.
Coins may jump in either direction.

Example:
Jump 1: Jump coin 10 on top of coin 7.
Jump 2: Jump coin 8 on top of coin 6. This is possible since coin 7 and 10 now form a stack of two coins.

 See The Solution Submitted by Brian Smith Rating: 3.0000 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 exhaustive search | Comment 4 of 8 |

To eliminate mirror image solutions, the following list shows only those whose first "from" move is from positions 1 through 5. In each pair the "from" is shown first and then the "to":

`4  1          6  9          8  3          2  5          7  104  1          6  9          8  3          2  5          10  74  1          6  9          8  3          5  2          7  104  1          6  9          8  3          5  2          10  74  1          6  9          8  3          7  10         2  54  1          6  9          8  3          7  10         5  24  1          6  9          8  3          10  7         2  54  1          6  9          8  3          10  7         5  24  1          7  3          5  9          2  6          8  104  1          7  3          5  9          2  6          10  84  1          7  3          5  9          6  2          8  104  1          7  3          5  9          6  2          10  84  1          7  3          5  9          8  10         2  64  1          7  3          5  9          8  10         6  24  1          7  3          5  9          10  8         2  64  1          7  3          5  9          10  8         6  25  2          7  10         3  8          1  4          6  95  2          7  10         3  8          1  4          9  65  2          7  10         3  8          4  1          6  95  2          7  10         3  8          4  1          9  65  2          7  10         3  8          6  9          1  45  2          7  10         3  8          6  9          4  15  2          7  10         3  8          9  6          1  45  2          7  10         3  8          9  6          4  1`
`Of these 24, there are actually only 3 basic solutions, starting 4  1          6  9          8  34  1          7  3          5  95  2          7  10         3  8`

as the remaining two moves are actually no different within each of these families--just a different order.

DECLARE SUB move (mNum!)
DIM SHARED histA(5), histB(5)
DIM SHARED board(10)
DIM SHARED solCt

FOR i = 1 TO 10: board(i) = 1: NEXT

move 1

PRINT solCt

SUB move (mNum)
IF mNum = 1 THEN top = 5:  ELSE top = 10
FOR i = 1 TO top
IF board(i) = 1 THEN
ct = 0
FOR j = i - 1 TO 1 STEP -1
IF ct = 2 AND board(j) = 1 THEN
GOSUB playIt
EXIT FOR
END IF
ct = ct + board(j)
NEXT
ct = 0
FOR j = i + 1 TO 10
IF ct = 2 AND board(j) = 1 THEN
GOSUB playIt
EXIT FOR
END IF
ct = ct + board(j)
NEXT
END IF
NEXT i
EXIT SUB

playIt:
histA(mNum) = i: histB(mNum) = j
board(i) = 0: board(j) = 2
IF mNum = 5 THEN
FOR st = 1 TO 5
PRINT histA(st); histB(st),
NEXT
solCt = solCt + 1
ELSE
move mNum + 1
END IF
board(i) = 1: board(j) = 1
RETURN

END SUB

 Posted by Charlie on 2004-10-20 02:49:03

 Search: Search body:
Forums (0)