And... here's a more concise implementation...
next1=: (#,~(#*-.) >. 1+i.@#) 1 1 1 0 1 1 1 1 0 1 1 1 1 1 0
next0=: 0 15 15 4 4 15 15 15 9 9 15 15 15 14 14 15
m345=: (,1)-:28 29 e.~(3;1,"0~next0,.next1)&;:
Is this more readable? Well, ... I have to admit that it's still not
as concise as ^0*1{3}0
In jqt you can take control of the term window, fetch its current contents,
cut them back and rewrite the term window.
Likewise other windows in the jqt IDE.
This link is a reference to help you do that:
http://code.jsoftware.com/wiki/Guides/Window_Driver/Session_Manager
As Nick S says, there is
And... here's a working implementation:
m345=:(,1)-:30 31 e.~(3;(0 10#:10*".;._2]0 :0))&;:
0.1 2.1 NB. start here (0 or more zeros)
11NB. fail here
13NB. second 1
14NB. third 1
51NB. first required zero
56NB. optional zeros or fourth 1
17NB.
Ah... ignore my noise here - Brian Schott pointed out my problem off list.
(I had a 16 where I should have had a 15 and I was not paying
attention to the error - it was not an error from the assert but an
error from the definition, which means the definition I was running
was a different one.)
I'
Hmm...
It seems to me that this kind of problem could use a sequential
machine (dyadic ;:) implementation to do some of the heavy lifting.
Sadly, I believe i have run into a J engine bug, which prevents me
from completing this idea.
I'll drop my broken code here to show what I mean:
m345=:(5;(0
Exactly. You could avoid boxing the indexes with
;"1 wh (xyz"_`[`]})"1 (9) $ <0
Henry Rich
On 1/5/2018 11:44 PM, Jimmy Gauvin wrote:
Maybe somebody has a better indexing recipe but this gets the job done:
$wh=:3 comb 9
84 3
xyz=: 1 1 1 0 ; 1 1 1 1 0 ; 1 1 1 1 1
84 20$ ; xyz ((<"1)(i.84
Maybe somebody has a better indexing recipe but this gets the job done:
$wh=:3 comb 9
84 3
xyz=: 1 1 1 0 ; 1 1 1 1 0 ; 1 1 1 1 1
84 20$ ; xyz ((<"1)(i.84)(;"0 1)wh) } 84 9$<0
1 1 1 0 1 1 1 1 0 1 1 1 1 1 0 0 0 0 0 0
1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 0
1 1 1 0 1 1 1 1 0 0 0 1 1 1 1 1 0 0
try. itself takes no more time than executing a short sentence like 2 + 3.
For placement of 111 1, find all the ways to rearrange
00xxx, and for each one, replace the first x with 1110, the second
with 0, the third with 1.
To find all the ways to rearrange 00xxx, find
Great suggestion. I actually played with it for quite a while last night,
got it all working. The solver can solve any puzzle I throw at it,
including those that barely have enough definition to hold together. I can
imagine puzzles it can't solve but those would have to be constructed to be
unso