The marbles in a bag puzzle in Color BASIC – part 2

See also: part 1, part 2 and part 3.

• 2020-03-31 – Corrected the spelling of Art’s last name. Sorry about that!

Well, you can disregard my previous article. I misunderstood the process Steve Ostrom was describing. I have a follow-up planned, but wanted to share Steve’s response when I explained what I thought the process was:

… the probability puzzle is a little more complex. Here is the idea: Put 4 trays in front of you, one for each color. Pull one marble and place it in the proper tray. Pull a second marble. Place in its tray. Continue pulling marbles until one of the trays contains 3 marbles. Stop there. That’s iteration #1. Replace all the marbles into the bag. Start again. Continue 100,000 times !! Now calculate the odds for each tray that it will be the tray that gets to 3 first.

Steve Ostrom

That’s a bummer, because I let mine run all weekend and got these results:

If my simulation had been correct, when a bag has five red, four blue, three white and three black marbles, the odds of pulling out three of the same color would have been:

• Red – 62.7% of the matches
• Blue – 24.7% of the matches
• White / Black – 6.2% of the matches

What I forgot to do is include a count of the number of times to pull marbles out of the bag! Without that, I can’t even show the results of my incorrect simulation.

I will be writing a “correct” simulation and sharing the results soon*.

* soon [so͞on] ADVERB
in or after a short time.

Oxford Dictionary definition of “soon”

Okay, fine. Hopefully soon. Soon for me, anyway. Maybe tomorrow. Or next week.

Math and Art

Others have responded on this and I plan to share their efforts and results as well. One of the most notable was seeing the legendary Art Flexser join in. Mr. Flesxer was responsible for the most popular DISK BASIC replacement the Color Computer ever had – ADOS. Back then I wanted ADOS so bad, but the thought of replacing a ROM chip seemed beyond my skills. “Wish I knew then, what I know now!” For those unfamiliar, ADOS is described in the CoCo FAQ as follows:

Description of Art Flexser’s ADOS from the Color Computer FAQ at CoCopedia.com

But I digress… Art implemented this puzzle using a modern basic, QB64. According to the website:

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

https://www.qb64.org/portal/

I will be taking a look at what he did, soon, and include his results with whatever I come up with and see if we all get the same results as Steve.

Until then…

One thought on “The marbles in a bag puzzle in Color BASIC – part 2”

This site uses Akismet to reduce spam. Learn how your comment data is processed.