On 6/23/07, Arie Groeneveld <[EMAIL PROTECTED]> wrote:
meaning they are even permutations. By saying this, one can ask 'are the
odd permutation arrangements of the puzzle unsolvable?' I tried several
and they always fail, and .... I'm not able to proof this ;-)
Given the desired end position
n=:1 2 3 4 5 6
and the three valid moves (represented as indices in the new
positions for each of the values at their previous positions)
o=: 3 2 1 0 4 5,0 4 3 2 1 5,:0 1 5 4 3 2
You can generate a list of all possible moves connected to the
end position by those moves
p=: o (] ~.@, ,/@:({"1/))^:_,:n
Any permutations not in p are unsolvable as each of the valid
moves are self inverting:
o{"1 o{"1 n
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm