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

See also: part 1


  • 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:

The correct results from an incorrect simulation.

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.

Please disregard.

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:

A-DOS was developed by Art Flexser. It came in three versions, ADOS for the CoCo 1 and 2, and ADOS 3 & Extended ADOS 3 for the CoCo 3. It was 100% compatible with RS-DOS if you didn’t need to patch Disk BASIC, and added features to RS-DOS, noteably 40 and 80 track drive support. ADOS came on a disk, and could be loaded into the CoCo, or you could customize ADOS, program an EPROM, and use the EPROM as your disk ROM, therefore booting your CoCo with ADOS. This was a neat, because many users then set their CoCos to boot with the 80 column screen. It also ran the CoCo at double-speed, even during disk and printer I/O, featured auto line numbering, arrow scroll through listings, auto edit of errors, macros, etc. Extended ADOS 3 added things like parellel printer output (assuming you had the right hardware), wildcard filenames, and a RAMdisk. This was arguably the most popular modified RS-DOS used with the CoCo.

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

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.

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…

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

  1. Pingback: The marbles in a bag puzzle in Color BASIC – part 3 | Sub-Etha Software

Leave a Reply

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