the queen appears wrong as it is supposed to be in 4th column from the left.


----- Original Message -----
From: Björn Helgason <gos...@gmail.com>
To: Programming forum <programm...@jsoftware.com>
Cc: 
Sent: Monday, December 29, 2014 2:34 PM
Subject: Re: [Jprogramming] Repeated rolling dice

I discovered the dice unicode while looking for the chess pieces.

I found them close by.

I am not sure if I am displaying the correct unicodes for the queen and
king:

  8 8$  u: (|.(8$9823),9820 9822 9821 9819 9818 9821 9822
9820),(32$32),(8$9817),9814 9816 9815 9812 9813 9815 9816 9814
♜♞♝♚♛♝♞♜
♟♟♟♟♟♟♟♟




♙♙♙♙♙♙♙♙
♖♘♗♔♕♗♘♖
On 29 Dec 2014 17:39, "Björn Helgason" <gos...@gmail.com> wrote:

>
> To display the dice:
>
> u: 9856+i. 6
> ⚀⚁⚂⚃⚄⚅
>
> u: 9855+5 1 4 1 5 2 2 6 2 4 5 6 1 3 6 2 1 4 4 2
> ⚄⚀⚃⚀⚄⚁⚁⚅⚁⚃⚄⚅⚀⚂⚅⚁⚀⚃⚃⚁
> On 29 Dec 2014 11:15, "Linda Alvord" <lindaalv...@verizon.net> wrote:
>
>> After reading this thread from September, I couldn't resist an "elementary
>> school" version, shown twice below:
>>
>>
>>
>>    f=: 13 :'>:?y$6'
>>
>>    ]A=:f 20                                     NB. Original rolls
>>
>> 5 1 4 1 5 2 2 6 2 4 5 6 1 3 6 2 1 4 4 2
>>
>>    }:1,6~:A
>>
>> 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1
>>
>>    ]B=:(}:1,6~:A)<;.1 A                        NB. Boxes show extra rolls
>>
>> --T-T-T-T-T-T-T---T-T-T---T-T---T-T-T-T-┐
>>
>> │5│1│4│1│5│2│2│6 2│4│5│6 1│3│6 2│1│4│4│2│
>>
>> L-+-+-+-+-+-+-+---+-+-+---+-+---+-+-+-+--
>>
>>    ]C=:+/"1 >B                                 NB. Value of rolls
>>
>> 5 1 4 1 5 2 2 8 4 5 7 3 8 1 4 4 2
>>
>>    $C                                          NB. Usable answers
>>
>> 17
>>
>>
>>
>>    f=: 13 :'>:?y$6'
>>
>>    ]A=:f 20                                    NB. Original rolls
>>
>> 1 2 6 6 6 5 3 5 1 6 6 3 1 4 2 6 4 1 2 2
>>
>>    }:1,6~:A
>>
>> 1 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 0 1 1 1
>>
>>    ]B=:(}:1,6~:A)<;.1 A                        NB. Boxes show extra rolls
>>
>> --T-T-------T-T-T-T-----T-T-T-T---T-T-T-┐
>>
>> │1│2│6 6 6 5│3│5│1│6 6 3│1│4│2│6 4│1│2│2│
>>
>> L-+-+-------+-+-+-+-----+-+-+-+---+-+-+--
>>
>>    ]C=:+/"1 >B                                 NB. Value of rolls
>>
>> 1 2 23 3 5 1 15 1 4 2 10 1 2 2
>>
>>     $C                                          NB. Usable answers
>>
>> 14
>>
>>
>>
>>  Linda
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: programming-boun...@forums.jsoftware.com
>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul
>> Miller
>> Sent: Friday, September 26, 2014 11:50 PM
>> To: Programming forum
>> Subject: Re: [Jprogramming] Repeated rolling dice
>>
>>
>>
>> In addition to Pascal's comments, "0 can sometimes run into an issue with
>> word formation rules (when the argument to the right begins with a
>> number).
>>
>>
>>
>> Thanks,
>>
>>
>>
>> --
>>
>> Raul
>>
>>
>>
>> On Fri, Sep 26, 2014 at 12:05 PM, Johann Hibschman <
>> <mailto:jhibsch...@gmail.com> jhibsch...@gmail.com>
>>
>> wrote:
>>
>>
>>
>> > Thanks, that's helpful, although the tacit version of "bulk" is a bit
>>
>> > too much for me to parse.
>>
>> >
>>
>> > I imagine factor of 2 helps because it gets you over the expected 6r5
>>
>> > rolls per "game", assuming I did that recurrence right
>>
>> > (e=(5r6*1)+1r6*(1+e)).
>>
>> >
>>
>> > I do have some lingering style questions though:
>>
>> >
>>
>> > 1. It looks to me like David Lambert's solution used both (&>) and
>>
>> > (">) to force a verb to apply to the atoms, which I would write ("0).
>>
>> > Are there any particular reasons to prefer one over the other? ("0)
>>
>> > may require a ([) to avoid merging with a follow-up literal, (&>)
>>
>> > seems a little like exploiting a side-effect of (>), and (">) could
>>
>> > just as easily be ("+) or any other 0 0 0 verb.
>>
>> >
>>
>> > 2. Is there any difference between (bind) and (@:)? They look to me
>>
>> > like they would be identical.
>>
>> >
>>
>> > Thanks,
>>
>> > Johann
>>
>> >
>>
>> > On Thu, Sep 25, 2014 at 3:10 PM, Raul Miller <
>> <mailto:rauldmil...@gmail.com> rauldmil...@gmail.com>
>>
>> > wrote:
>>
>> > > That is very close to what I came up with, for the case where we
>>
>> > > want
>>
>> > only
>>
>> > > a single value from our result:
>>
>> > >
>>
>> > >    d6=:1 + ? bind 6
>>
>> > >    repd6=: [:+/(,d6)^:(6={:)@d6
>>
>> > >
>>
>> > > Here's a variation on Roger Hui's approach, for the case where we
>>
>> > > want N values from our result:
>>
>> > >
>>
>> > > d6s=: 1 + [: ? #&6
>>
>> > > bulk=:{.#&0(],~(+/;.1~1:}:@,0~:6&|)@(],d6s@[))^:(
>> <mailto:0=6&;|@%7b:@%7b.)%5e:_~> 0=6&|@{:@{.)^:_~]
>>
>> > >
>>
>> > > Example use:
>>
>> > >    bulk 20
>>
>> > > 5 5 5 4 3 3 2 3 3 9 1 4 16 3 3 1 3 17 3 4
>>
>> > >
>>
>> > > This would probably be much clearer if implemented explicitly rather
>>
>> > > than tacitly, and probably would be more efficient also. So:
>>
>> > >
>>
>> > > bulkd6s=:3 :0
>>
>> > >   r=. i. 0
>>
>> > >   while. y >: #r do.
>>
>> > >     r=. r, d6s y
>>
>> > >     mask=. }: 1, 0~:6|r
>>
>> > >     r=. mask +/;.1 r
>>
>> > >   end.
>>
>> > >   y{.r
>>
>> > > )
>>
>> > >
>>
>> > > But statistically speaking, this is still not as efficient as it
>>
>> > > could
>>
>> > be.
>>
>> > > I think we'd do better with:
>>
>> > >
>>
>> > > bulkd6=:3 :0
>>
>> > >   r=. i. 0
>>
>> > >   while. y >: #r do.
>>
>> > >     r=. r, d6s 2*y
>>
>> > >     mask=. }: 1, 0~:6|r
>>
>> > >     r=. mask +/;.1 r
>>
>> > >   end.
>>
>> > >   y{.r
>>
>> > > )
>>
>> > >
>>
>> > > Do you see why this tends to be more efficient?
>>
>> > >
>>
>> > > Thanks,
>>
>> > >
>>
>> > > --
>>
>> > > Raul
>>
>> > >
>>
>> > >
>>
>> > > On Thu, Sep 25, 2014 at 11:50 AM, 'Pascal Jasmin' via Programming <
>>
>> > >  <mailto:programm...@jsoftware.com> programm...@jsoftware.com> wrote:
>>
>> > >
>>
>> > >> this works
>>
>> > >>
>>
>> > >> (, >:@?@6:)^:((0=#) +. 6={:)^:_ i.0
>>
>> > >>
>>
>> > >>    ([: +/ (, >:@?@6:)^:((0=#) +. 6={:)^:_) i.0
>>
>> > >> 11
>>
>> > >>
>>
>> > >>
>>
>> > >>
>>
>> > >> ----- Original Message -----
>>
>> > >> From: Johann Hibschman < <mailto:jhibsch...@gmail.com>
>> jhibsch...@gmail.com>
>>
>> > >> To: Programming forum < <mailto:programm...@jsoftware.com>
>> programm...@jsoftware.com>
>>
>> > >> Cc:
>>
>> > >> Sent: Thursday, September 25, 2014 9:06 AM
>>
>> > >> Subject: [Jprogramming] Repeated rolling dice
>>
>> > >>
>>
>> > >> 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>
>> http://www.jsoftware.com/forums.htm
>>
>> > >>
>>
>> > >> -------------------------------------------------------------------
>>
>> > >> --- For information about J forums see
>>
>> > >>  <http://www.jsoftware.com/forums.htm>
>> http://www.jsoftware.com/forums.htm
>>
>> > >>
>>
>> > > --------------------------------------------------------------------
>>
>> > > -- For information about J forums see
>>
>> > >  <http://www.jsoftware.com/forums.htm>
>> http://www.jsoftware.com/forums.htm
>>
>> > ----------------------------------------------------------------------
>>
>> > For information about J forums see  <
>> http://www.jsoftware.com/forums.htm>
>> http://www.jsoftware.com/forums.htm
>>
>> >
>>
>> ----------------------------------------------------------------------
>>
>> For information about J forums see  <http://www.jsoftware.com/forums.htm>
>> http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
----------------------------------------------------------------------
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