On Sun, Nov 4, 2012 at 5:17 PM, I wrote:
> Here's a brute force implementation of A for sudoku:
>
>    C=: |: R=: ,9#,:i.9 NB. identity within columns (C) and rows (R)
>    B=: ,3#3#"1 i.3 3 NB. identity within boxes
>    A=: ((2*>/~i.81)+</~i.81) * (+. |:) (C =/ R) +. (C =/B ) +. (R =/ B)

That was wrong, in 4809 different locations.

Here's a corrected version:

   C=: , |: 9#,:i.9 NB. identity within columns (C)
   R=: ,9#,:i.9 NB. identity within rows (R)
   B=: ,3#3#"1 i.3 3 NB. identity within boxes
   A=: ((2*>/~i.81)+</~i.81) * (+. |:) (C =/ R) +. (C =/B ) +. (R =/ B)

FYI,

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

Reply via email to