"This" is also an example where the problem statement, including the model
and the display of its result, heavily influenced the solutions.  To avoid
this kind of bias in this case, perhaps you might say:

Roll a dice.  If you don't get a 6, stop; if you do get a 6, roll the dice
again.  Do m trials of this experiment and report all the dice rolls.


But I suspect this statement is influenced by what I know about the
solution.


On Thu, Sep 25, 2014 at 10:40 AM, Devon McCormick <devon...@gmail.com>
wrote:

> This looks like a good addition to my growing set of "array-thinking"
> examples.
>
> On Thu, Sep 25, 2014 at 12:32 PM, Roger Hui <rogerhui.can...@gmail.com>
> wrote:
>
> > ​Compared to the other solutions posted so far, I believe it is more
> > straightforward to do a long sequence of dice rolls and then split it up
> > according to your specified criteria.  The split point are where the
> > _previous_ roll is _not_ a 6.  Thus:
> >
> > ​   x=: 1+1e4 ?@$ 6   NB. long sequence of dice rolls
> >    x
> > 5 4 6 1 5 4 5 6 1 3 5 1 2 3 3 6 5 2 4 5 6 5 5 3 6 2 4 4 1 3 6 4 2 1 5 6
> 1 6
> > 6 6 6 6 5 4 6 1 2 3 2 5 1 2 1 3 2 ...
> >    (}:1,6~:x) <;.1 x
> >
> >
> ┌─┬─┬───┬─┬─┬─┬───┬─┬─┬─┬─┬─┬─┬───┬─┬─┬─┬───┬─┬─┬───┬─┬─┬─┬─┬───┬─┬─┬─┬───┬───────────┬─┬───┬─┬─┬─┬─┬─┬─┬─┬─┬─┬
> > │5│4│6 1│5│4│5│6 1│3│5│1│2│3│3│6 5│2│4│5│6 5│5│3│6 2│4│4│1│3│6 4│2│1│5│6
> > 1│6 6 6 6 6 5│4│6 1│2│3│2│5│1│2│1│3│2│ ...
> >
> >
> └─┴─┴───┴─┴─┴─┴───┴─┴─┴─┴─┴─┴─┴───┴─┴─┴─┴───┴─┴─┴───┴─┴─┴─┴─┴───┴─┴─┴─┴───┴───────────┴─┴───┴─┴─┴─┴─┴─┴─┴─┴─┴─┴
> >
> >
> >
> >
> > On Thu, Sep 25, 2014 at 6:06 AM, Johann Hibschman <jhibsch...@gmail.com>
> > wrote:
> >
> > > Hi all,
> > >
> > > For fun, I've been running some statistics for a game with an unusual
> > > rule for rolling dice: if a 6 is rolled, roll again and add the
> > > result, repeating on any subsequent 6s. I wanted to implement this in
> > > J, collecting all the individual rolls (rather than just the sum.)
> > >
> > > It seems like there should be a more clever and elegant way to do
> > > this, but this is what I have:
> > >
> > > NB. Simple roll.
> > > roll0 =: >:@?
> > >
> > > NB. This seems to work, but it's not very clever.
> > > roll =: 3 : 0
> > >   r =. >:?y
> > >   if. r=y do. r=. r,(roll y) end.
> > >   r
> > > )
> > >
> > > NB. Attempt at iterating via power.  Fails because repeats
> > > NB. signal termination.
> > > roll0^:(6&=)^:(<_) 6
> > >
> > > NB. Attempt at iterating via agenda.  Not even close yet.
> > > NB. ]`(]+$:) @. (=&6)  NB. where to stick in the roll?
> > >
> > > This gives what I expect:
> > >
> > >    roll"0 ] 10#6
> > > 6 1 0
> > > 3 0 0
> > > 3 0 0
> > > 2 0 0
> > > 5 0 0
> > > 2 0 0
> > > 6 6 2
> > > 2 0 0
> > > 1 0 0
> > > 6 3 0
> > >
> > > But is there a better way to do this? Also, are there any known issues
> > > with the RNG? I've not gathered enough statistics to prove it, but the
> > > results look clumpier (more identical values in a row) than I expect.
> > > Now, I know that's a common cognitive bias, so it may just be me, but
> > > is there a discussion of the quality of the RNG somewhere?
> > >
> > > Thanks,
> > > Johann
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
>
> --
> Devon McCormick, CFA
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to