---Oleg Kobchenko wrote:
> It is not quite clear how *blocks* are defined: fully
> surrounded by zeros, etc.
>
Thanks for the question, I'll try to be clearer.

Blocks must be rectangular so they can be described by the index of their top 
left corner and their shape (number of rows and columns) (i.e. the left 
argument of ;.0)
Here is one block:
3 4 NB. Index of top left corner of block
2 3 NB. Number of rows and columns in the block

The list of blocks must include or "cover" all the 1s in the array once and 
only once. For tst1 below, a possible solution would be list of 42 blocks of 1 
row and 1 column (i.e. a block for each 1). Solutions that produce fewer blocks 
are better. The best possible solution for tst1 would be a list of 5 blocks (I 
think I gave them in my first post).

Is that clearer?

tst1=: _99&".;._2 (0 : 0)
0 0 0 1 1 1
0 0 0 0 0 0
1 1 1 0 0 0
0 0 0 1 1 1
0 0 0 1 1 1
1 1 1 0 0 0
1 1 1 0 0 0
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
0 0 0 1 1 1
0 0 0 1 1 1
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to