2011/3/14 Björn Helgason <[email protected]>:
>   a=:4 5$ 0 1 2 4 2 3 1 0 _ _ _
>   b=:_,.~_,._,a,_
>
>   b
> _ _ _ _ _ _ _
> _ 0 1 2 4 2 _
> _ 3 1 0 _ _ _
> _ _ 0 1 2 4 _
> _ 2 3 1 0 _ _
> _ _ _ _ _ _ _
>
> The goal is to find the solution paths to the pairs having three or less
> straight lines connections.
>
> I need to get the following solution:
>   1 1; 1 0; 2 0; 3 0; 3 1; 3 2
>   1 2; 2 2
>   1 3; 0 3; 0 4; 0 5; 1 5
>   1 4; 2 4; 2 5; 3 5
>   1 5; 2 5; 2 4; 3 4
>   2 3; 2 4; 2 5; 2 6; 3 6; 4 6; 4 5; 4 4
>   3 3; 4 3

Your description was a bit ambiguous, but by inspecting your data, I
believe this is the feature set you are asking for:

A solution path consists of a sequence of index pairs into b
These solution paths must each contain more than one index pair.
The first index pair of a solution path must sort before the last
index pair of that solution path
The first index pair of a solution path must select the same value
from b that the last index pair selects
The first (and last) index pair of a solution path cannot select the
value _ from b
All index pairs except the first and last (if there are any) must
select the value _ from b
Adjacent index pairs in a solution path must be different
Adjacent index pairs in a solution path must contain only one index
which is different
The index which differs between adjacent pairs in a solution path must
differ by 1
The same index pair may not appear twice in one solution path (but may
appear in different solution paths)
An index may not be repeated more than four times in a solution path
except by introducing a different index in between them.

Do any of these conflict with what you are trying to accomplish?

Thanks,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to