Jump to content

Randoms


fandom34
 Share

You are about to reply to a thread that has been inactive for 1731 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Here's a script to solve Molly's riddle...

default
{
    state_entry()
    {
        llSay(0, "Ready!");
    }

// There are six card faces, equally likely to be drawn at random from cards that have tops and bottoms.
// Here's how we'll describe the cards and faces
// First two characters describe the card: BB = Blue/Blue, BR = Blue/Red, RR = Red/Red.
// Third letter describes the face color, B = Blue, R = Red.
// Now we have a way to describe the six possible face draws. We'll index them so we can describe them numerically.
// So, here are the six possible draws with index values in parens:
// BBB(6)
// BBB(5)
// BRB(4)
// BRR(3)
// RRR(2)
// RRR(1)
// Each face is equally likely to be drawn. We want to know...
// If you draw a card showing a blue face, what's the chance the hidden face is blue?

// We'll use llFrand to produce random index numbers from 0 to 6, and set thresholds to determine which face/card has been selected.
// If we draw an index less than 3, we've got a red face showing and we skip that draw. We're only interested in draws of blue faces.
// If we draw an of three or greater, we've drawn a blue face and we count that.
// If we draw an index of four or greater, we've drawn the blue/blue card, so the hidden face is blue and we count that.
// At the end, we divide the number of hidden blue faces by the number of showing blue faces, and that's our probability.

    touch_start(integer total_number)
    {
        llOwnerSay("Hang on a sec!");
        integer i;
        integer count = 100000;
        integer blueShowing;
        integer blueHidden;
        float card;
        float prob;
        
        for(i=0;i<count;i++)
        {
            card=llFrand(6);
           if(card>=3)
            {
                blueShowing++;
                if(card>=4)
                {
                    blueHidden++;
                }
            }
        }
        llOwnerSay("Out of "+(string)count+" random attempts.");
        llOwnerSay((string)blueShowing+" blue faces were drawn.");
        llOwnerSay((string)blueHidden+" of those had hidden blue faces.");
        prob = (float)blueHidden/(float)blueShowing;
        llOwnerSay((string)(prob*100)+"%");
    }
}

Wanna see the answer?

  • Make a wooden cube
  • Create a new script in it
  • Copy the script code above
  • Select all the text in the script you just created (Cmd-A/Ctrl-A)
  • Paste the copied code into the script
  • Click "Save"
  • Wait for "Ready!" in chat
  • Touch the cube
  • Like 3
Link to comment
Share on other sites

6 minutes ago, Madelaine McMasters said:

Wanna see the answer?

  • Make a wooden cube
  • Create a new script in it
  • Copy the script code above
  • Select all the text in the script you just created (Cmd-A/Ctrl-A)
  • Paste the copied code into the script
  • Click "Save"
  • Wait for "Ready!" in chat
  • Touch the cube

That is sooooooo cheating.

  • Haha 2
Link to comment
Share on other sites

5 minutes ago, Scylla Rhiadra said:

That is sooooooo cheating.

People will argue whether the answer is 1/2 or 2/3, depending on how they define the initial conditions of the experiment. Molly already rejected the probability my script will report.

Don't I at least get credit for using SL to show my work?

Edited by Madelaine McMasters
  • Like 2
Link to comment
Share on other sites

Just now, Madelaine McMasters said:

People will argue whether the answer is 1/2 or 2/3, depending on how they define the initial conditions of the experiment.

I get that.

Will the scripted cube do the arguing for us?

Isn't that what technology is for?

(I love labour -- and argument -- saving devices!)

Link to comment
Share on other sites

trivial, 2/3

there are 3 possible cases for a blue card up (each is as likely as the others) we can exclude the 3 cases of red side up

  1. top of bicoloured card
  2. top of full blue card
  3. bottom of full blue card

in 2 of 3 cases the bottom is also blue

Edited by Fionalein
  • Like 2
Link to comment
Share on other sites

3 minutes ago, Scylla Rhiadra said:

I get that.

Will the scripted cube do the arguing for us?

Isn't that what technology is for?

(I love labour -- and argument -- saving devices!)

My personal experience is that scripts don't argue for me, they argue with me. And they do it without emotional susceptibility, which deprives me of much of my persuasive power.

Link to comment
Share on other sites

2 minutes ago, Fionalein said:

trivial, 2/3

there are 3 possible cases for a blue card up

  1. top of bicoloured card
  2. top of full blue card
  3. bottom of full blue card

in 2 of 3 cases the bottom is also blue

My script, and the reasoning that generated it, agree with you.

I'm not sure about it being trivial, as many people's intuition points them to 1/2.

Edited by Madelaine McMasters
  • Like 1
Link to comment
Share on other sites

1 minute ago, Madelaine McMasters said:

My personal experience is that scripts don't argue for me, they argue with me. And they do it without emotional susceptibility, which deprives me of much of my persuasive power.

And this is why I avoid coding wherever possible. 

That sounds absolutely no fun at all.

Link to comment
Share on other sites

3 minutes ago, Scylla Rhiadra said:
5 minutes ago, Madelaine McMasters said:

My personal experience is that scripts don't argue for me, they argue with me. And they do it without emotional susceptibility, which deprives me of much of my persuasive power.

And this is why I avoid coding wherever possible. 

That sounds absolutely no fun at all.

The fun is in the chase.  It's like solving a good crossword puzzle or a murder mystery.  Solving the problem is the exciting part.  Once it is solved, the fun is gone.  I toss the paper as soon as I finish the day's puzzle, and I don't look back at last week's big scripting challenge once it's in the bag.  It's the same way with vacations.  I don't much care for being somewhere, but getting somewhere is great fun.  

  • Like 2
Link to comment
Share on other sites

13 minutes ago, Madelaine McMasters said:

My personal experience is that scripts don't argue for me, they argue with me. And they do it without emotional susceptibility, which deprives me of much of my persuasive power.

Well at least you never got to a point where you knew what to write but could not even explain to yourself why you have to...

"//no idea why but this seems to do the trick" is the best comment ever :D and one I use quite often...

  • Like 1
Link to comment
Share on other sites

4 minutes ago, Fionalein said:

"//no idea why but this seems to do the trick" is the best comment ever :D and one I use quite often...

You'll find that comment in my code as well, along with a fair amount of cursing.

Many times, I have revisited very old code and wondered what the hell I was thinking (or if I was thinking) when I wrote it. Believing I'm so much smarter now, I improve the nonsense and it stops working. After some gnashing of teeth, I realize that I was actually fairly smart all those years ago. That feels good until I realize that means I may be no smarter now.

Dammit.

  • Haha 3
Link to comment
Share on other sites

2 minutes ago, Madelaine McMasters said:

Many times, I have revisited very old code and wondered what the hell I was thinking (or if I was thinking) when I wrote it. Believing I'm so much smarter now, I improve the nonsense and it stops working. After some gnashing of teeth, I realize that I was actually fairly smart all those years ago. That feels good until I realize that means I may be no smarter now.

they told you working in old code by someone else was hard - they omitted the fact it is always hard no matter who wrote it - doesn't help a bit if it was yourself

  • Like 4
Link to comment
Share on other sites

On 7/20/2019 at 6:51 PM, Ansiri said:

Is that Echo behind the tree? I like those type of old paintings.

 

That riddle reminded me of this song, it has nice lyrics and sounds nice too.

 

 

That song made me remember the OP of Elfen Lied for some reason. I'd post it, but it shows nipples...

Link to comment
Share on other sites

40 minutes ago, Rolig Loon said:

It's the same way with vacations.  I don't much care for being somewhere, but getting somewhere is great fun.  

"The journey is the reward" is a McMasters family mantra, along with "people are weird", uttered with the understanding that McMasters are people too, which leads to "we have met the enemy and he is us*".

*Pogo

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1731 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...