~seanld/montyhallauto

Concurrent auto simulator for the Monty Hall problem.
382a12b0 — Sean Wilkerson 11 months ago
Clarify README
649a1c94 — Sean Wilkerson 1 year, 4 days ago
Add BSD 3-clause license
537a391e — Sean Wilkerson 1 year, 4 days ago
Make warning prettier with `-v` enabled

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~seanld/montyhallauto
read/write
git@git.sr.ht:~seanld/montyhallauto

You can also use your local clone with git send-email.

#Monty Hall Simulator

This project simulates win rate of using the "switch to unopened door every time" strategy in the Monty Hall problem. It is slightly configurable. You can give it the number of iterations you want to perform, how many doors your want to simulate (defaults to the classic 3), and specify how many concurrent instances of the simulation you want to run.

#Building & Running

Typical straightforward Go build process. Install Go to your system, navigate to this cloned repo directory, and:

go build .

That will compile an executable. Now, to run the simulation:

./montyhallauto

That will run the simulation with the defaults (3 doors, 10 iterations, 1 instance).

Here's a better (assuming you have at least a quad-core CPU), more accurate simulation:

./montyhallauto -n 1000000 -d 5 -c 4

That will run the Monty Hall problem with 5 doors, 1 million times, using 4 goroutines. Increasing -c only yields performance improvements for systems with at least that many cores/threads available.