In the spirit of simplicity, here is the best beginning of the Turkey Roll.
If I had designed it correctly in the first place.
Here is the beginning of a smaller and better Turkey Roll.
one =: ' ',' o ',:' '
two =: 'o ',' ',:' o'
three =: 'o ',' o ',:' o'
four =: 'o o',' ',:'o o'
five =: 'o o',' o ',:'o o'
six =: 'o o','o o',:'o o'
]dicekm =: one;two;three;four;five;six
tossrs=: ] {~ [: ? [ $ [: # ]
2 10 tossrs dice
2 10 tossrs dice
Can you "find" the actual simulation data and provide a frequency
distribution.
Maybe then someone will be able to toss the big bucket of dice.
Sorry to take so long to simplify this but it takes a while to change a mind
set on something else.
I do like the looks of your dice much better, but they could be explored
later in a class.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ric Sherlock
Sent: Monday, December 05, 2011 2:44 PM
To: Programming forum
Subject: Re: [Jprogramming] Turkey Roll - Challenge 2
Nice!
Here's a "simpler" version of faces that conforms to the specified rules.
faces=: (' o' {~ ((": i.3 3) e."1 ":))&.> 4 80 840 8620 86420 865320
I agree that it is more natural to give faces as an argument to toss so:
toss=: ] {~ [ ?@$ #@]
2 10 toss faces
Or if we're following the rules:
toss=: ] {~ [: ? [ $ [: # ]
2 10 toss faces
On Tue, Dec 6, 2011 at 3:49 AM, Raul Miller <[email protected]> wrote:
> Personally, I have been baffled by a number of the choices and
requirements
> here. And, by this, I mean that I do not understand them.
>
> That said, here is my current interpretation of a mix of some of the
> statements expressed here, about what is being accomplished:
>
> faces=: {&' o'@((i.3 3)e.&":"1])&.>4 80 840 8620 86420 865320
> toss=: (] {~ (?@$ #)) ".bind 'faces'
>
> Example use, with ascii box drawing enabled:
>
> toss 2 10
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> |o |o |o o|o |o |o |o |o o|o o|o o|
> | o | o | o | o | o | | | | o |o o|
> | o| o|o o| o| o| o| o|o o|o o|o o|
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> |o |o o|o |o o|o o|o |o |o |o o|o |
> | o | o | | o | | | | | | |
> | o|o o| o|o o|o o| o| o| o|o o| o|
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> toss 2 10
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> |o |o |o o|o |o o|o |o o|o o|o o|o |
> | | | | o |o o| o | | o |o o| |
> | o| o|o o| o|o o| o|o o|o o|o o| o|
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> |o o|o |o o|o o|o o|o o| |o o|o o|o o|
> | | | o | | | o | o | | | |
> |o o| o|o o|o o|o o|o o| |o o|o o|o o|
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
>
> Notes:
>
> 1. I spaced my pips out wider, horizontally, than the original. I think
> this looks better.
> 2. toss has 'faces' as an implicit dependency
> 3. I can change the number of dice being tossed by changing the argument
to
> toss
>
> In my opinion, this is not a very good design. In "real life" code, I
> would either replace (". bind 'faces') with (faces) or I would make it an
> argument to the function.
>
> I could probably compress a few characters out of the definition of faces,
> but it would become more mysterious if I did so.
>
> --
> Raul
> ----------------------------------------------------------------------
> 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