I have a 3d array that is the formatted output of a table. I capture
snapshots of it at different points in my processing, in a rank 3 array. I
want to flip between pages to see how the processing progresses. I thought
I would clear the screen, then display the output, that being one of the
stacked sheets. Can someone point me in the right direction? I have
researched this for hours and just can't find the right manual or google.
Now, I manipulate this table column by column and row by row, Somewhere I
read that amend would update anything that from would fetch. But I find
that to be wrong.
I was able to fetch a row of my table with
buildline =: (<: | y){table
and a column with
buildline =: (y){"1 table
but
table =: bitvector (y)}"1 table
would not work.
I can update a row with
table =: (accumand)(<: | y) } table
but the column is more difficult. I came up with two approaches. One way
was to transpose the table, update what was now a row, and then transpose
the result.
table =: |: (accumand) (y) } |:table
What I settled on was to build a boxed set of coordinates
table =: (accumand) (<(i.tsize);y) } table
it probably does not matter for my application, we are talking, at the
largest, 20x20 boolean arrays. I am wondering if I need to throw around
more data.
(The above is the limit of my questions.)
(y can be a zero or positive scalar, indicating a column, or a scalar from
-tsize to _1 - (generated with }:i: tsize) which indicates a row.
For further information, the program solves one of those solitare games
where you have a series of numbers, and you get numbers for every row and
every column. Suppose that the numbers for column 1 were 8,3,4, this
regular expression would have to match:
^0*1{8,8}0+1{3,3}0+1{4,4}0*$
Table size is fixed based on the puzzle, but can vary between 5 and 20.
Anyway, I did a lot of if. then. else. stuff because my first simple
version of the program took over 700 seconds to do one round of
calculations on a single row or column and the most rounds I have seen a
puzzle take is 17 iterations before it could place all the marks, and with
aggressive early pruning, I was able to get about 2 orders of magnitude
improvement. I process 400 rows+columns in under 2 seconds. If you have
a line where the numbers are, say, 1 1 1 1 1 1, it would generate thousands
of potential solutions, which would result in naught if there were no other
constraints - so I prune those cases - I don't process those lines until I
detect a constraint on that line because without a constraint I will not
learn anything.
On a personal note, I find that I can get obsessed with solitare games to
the exclusion of everything else I want to do. It helps to break the
obsession if I write a solver.
--
Of course I can ride in the carpool lane, officer. Jesus is my constant
companion.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm