Skip to content

Commit dc211cb

Browse files
committed
Initial commit.
0 parents  commit dc211cb

13 files changed

+939
-0
lines changed

LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<div id="top" align="center">
2+
3+
<!-- Shields Header -->
4+
[![Contributors][contributors-shield]](https://github.com/franckferman/Monty-Hall-Problem-Simulator/graphs/contributors)
5+
[![Forks][forks-shield]](https://github.com/franckferman/Monty-Hall-Problem-Simulator/network/members)
6+
[![Stargazers][stars-shield]](https://github.com/franckferman/Monty-Hall-Problem-Simulator/stargazers)
7+
[![License][license-shield]](https://github.com/franckferman/Monty-Hall-Problem-Simulator/blob/stable/LICENSE)
8+
9+
<!-- Logo -->
10+
<a href="https://github.com/franckferman/Monty-Hall-Problem-Simulator">
11+
<img src="https://raw.githubusercontent.com/franckferman/Monty-Hall-Problem-Simulator/refs/heads/stable/docs/github/graphical_resources/Logo-Monty-Hall-Problem-Simulator.png" alt="Monty-Hall-Problem-Simulator Logo" width="auto" height="auto">
12+
</a>
13+
14+
<!-- Title & Tagline -->
15+
<h3 align="center">🚪 Monty Hall Problem Simulator</h3>
16+
<p align="center">
17+
<em>Simulate, analyze, and visualize your chances in the famous Monty Hall paradox.</em>
18+
<br>
19+
A Go-powered simulator for the Monty Hall problem with statistical analysis.
20+
</p>
21+
22+
</div>
23+
24+
## 📜 Table of Contents
25+
26+
<details open>
27+
<summary><strong>Click to collapse/expand</strong></summary>
28+
<ol>
29+
<li><a href="#-about">📖 About</a></li>
30+
<li><a href="#-contributing">🤝 Contributing</a></li>
31+
<li><a href="#-star-evolution">🌠 Star Evolution</a></li>
32+
<li><a href="#-license">📜 License</a></li>
33+
<li><a href="#-contact">📞 Contact</a></li>
34+
</ol>
35+
</details>
36+
37+
## 📖 About
38+
39+
**Monty-Hall-Problem-Simulator**: _A Go-based simulator to explore and visualize the famous Monty Hall paradox_.
40+
41+
This simulator was originally developed as part of a personal learning journey to better understand probabilities, paradoxes, and to demonstrate the Monty Hall problem through real simulations — beyond theoretical explanations.
42+
43+
Initially created as a personal experiment, it later became public because I believe others might benefit from having a concrete, hands-on way to see the paradox in action.
44+
45+
> ⚠️ Note: Although fully functional and optimized, this project remains a personal and educational experiment.
46+
> It is not a commercial product, but rather a public code archive aimed at educational, academic, or experimental uses.
47+
48+
The project combines secure random generation, statistical analysis, and clean modular Go code, making it a reusable and extendable tool for anyone curious about probabilistic paradoxes, statistics, or Golang.
49+
50+
> Feel free to reuse, adapt, or improve it as you wish.
51+
52+
### ⚙️ Features
53+
54+
- ✅ Secure and realistic simulations using cryptographically secure randomness (no pseudo-random hacks).
55+
- ✅ Detailed statistical output, including win rate percentages for both "switch" and "stay" strategies.
56+
- ✅ Clean and modular architecture following Go idiomatic practices for easy customization and extensions.
57+
- ✅ Cross-platform pre-built binaries (Linux, Windows, MacOS Intel & ARM64) — ready to use.
58+
59+
<p align="center">
60+
<img src="https://raw.githubusercontent.com/franckferman/Monty-Hall-Problem-Simulator/refs/heads/stable/docs/github/graphical_resources/Screenshot-Monty-Hall-Problem-Simulator-Demo.png" alt="Monty-Hall-Problem-Simulator Demo Screenshot" width="auto" height="auto">
61+
</p>
62+
63+
<p align="right">(<a href="#top">🔼 Back to top</a>)</p>
64+
65+
## 🤝 Contributing
66+
67+
Vos contributions, retours et suggestions jouent un rôle essentiel dans l’amélioration continue de ce projet. Que ce soit pour signaler un problème, proposer une nouvelle fonctionnalité ou soumettre une amélioration, chaque contribution compte et est la bienvenue.
68+
69+
<p align="right">(<a href="#top">🔼 Back to top</a>)</p>
70+
71+
## 🌠 Star Evolution
72+
73+
Découvrez l’évolution des étoiles attribuées à ce projet et suivez sa croissance au fil du temps:
74+
75+
<a href="https://star-history.com/#franckferman/Monty-Hall-Problem-Simulator&Timeline">
76+
<picture>
77+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=franckferman/Monty-Hall-Problem-Simulator&type=Timeline&theme=dark" />
78+
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=franckferman/Monty-Hall-Problem-Simulator&type=Timeline" />
79+
</picture>
80+
</a>
81+
82+
Chaque étoile compte. Merci pour votre soutien. Vos encouragements nourrissent notre motivation et contribuent à l’évolution du projet. ✨
83+
84+
## 📚 License
85+
86+
Ce projet est sous licence GNU Affero General Public License, Version 3.0 (AGPL-3.0). Pour plus de détails, veuillez consulter le fichier de licence dans le dépôt: [Read the license on GitHub](https://github.com/franckferman/Monty-Hall-Problem-Simulator/blob/stable/LICENSE)
87+
88+
<p align="right">(<a href="#top">🔼 Back to top</a>)</p>
89+
90+
## 📞 Contact
91+
92+
[![ProtonMail][protonmail-shield]](mailto:[email protected])
93+
[![LinkedIn][linkedin-shield]](https://www.linkedin.com/in/franckferman)
94+
[![Twitter][twitter-shield]](https://www.twitter.com/franckferman)
95+
96+
<p align="right">(<a href="#top">🔼 Back to top</a>)</p>
97+
98+
<!-- MARKDOWN LINKS & IMAGES -->
99+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
100+
[contributors-shield]: https://img.shields.io/github/contributors/franckferman/Monty-Hall-Problem-Simulator.svg?style=for-the-badge
101+
[contributors-url]: https://github.com/franckferman/Monty-Hall-Problem-Simulator/graphs/contributors
102+
[forks-shield]: https://img.shields.io/github/forks/franckferman/Monty-Hall-Problem-Simulator.svg?style=for-the-badge
103+
[forks-url]: https://github.com/franckferman/Monty-Hall-Problem-Simulator/network/members
104+
[stars-shield]: https://img.shields.io/github/stars/franckferman/Monty-Hall-Problem-Simulator.svg?style=for-the-badge
105+
[stars-url]: https://github.com/franckferman/Monty-Hall-Problem-Simulator/stargazers
106+
[license-shield]: https://img.shields.io/github/license/franckferman/Monty-Hall-Problem-Simulator.svg?style=for-the-badge
107+
[license-url]: https://github.com/franckferman/Monty-Hall-Problem-Simulator/blob/stable/LICENSE
108+
[protonmail-shield]: https://img.shields.io/badge/ProtonMail-8B89CC?style=for-the-badge&logo=protonmail&logoColor=blueviolet
109+
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=blue
110+
[twitter-shield]: https://img.shields.io/badge/-Twitter-black.svg?style=for-the-badge&logo=twitter&colorB=blue
1.36 MB
Binary file not shown.
1.43 MB
Binary file not shown.
1.45 MB
Binary file not shown.
1.44 MB
Binary file not shown.

build.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
3+
# ============================
4+
# 🏗️ Monty Hall Problem Simulator - Build Script
5+
# ============================
6+
7+
set -e # Stop if error occurs
8+
set -u # Treat unset variables as error
9+
set -o pipefail # Handle errors in pipelines
10+
11+
# ----------- Config -----------
12+
PROJECT_NAME="Monty-Hall-Problem-Simulator"
13+
MAIN_FILE="main.go"
14+
OUTPUT_DIR="bin"
15+
16+
# Clean old binaries
17+
echo "🧹 Cleaning previous builds..."
18+
rm -rf "$OUTPUT_DIR"
19+
mkdir -p "$OUTPUT_DIR"
20+
21+
# ----------- Build Flags -----------
22+
BUILD_FLAGS="-trimpath -ldflags='-s -w'"
23+
CGO_ENABLED=0
24+
25+
# ----------- Build Targets -----------
26+
declare -A TARGETS
27+
TARGETS=(
28+
["Linux"]="GOOS=linux GOARCH=amd64"
29+
["Windows"]="GOOS=windows GOARCH=amd64"
30+
["MacOS"]="GOOS=darwin GOARCH=amd64"
31+
["MacOS-ARM64"]="GOOS=darwin GOARCH=arm64"
32+
)
33+
34+
# ----------- Build Process -----------
35+
echo "🚀 Starting build process..."
36+
37+
for target in "${!TARGETS[@]}"; do
38+
echo "🔨 Building for $target..."
39+
40+
# Output file name
41+
output_file="$OUTPUT_DIR/$PROJECT_NAME-$target"
42+
[ "$target" == "Windows" ] && output_file="$output_file.exe"
43+
44+
# Command
45+
build_cmd="CGO_ENABLED=$CGO_ENABLED ${TARGETS[$target]} go build $BUILD_FLAGS -o $output_file $MAIN_FILE"
46+
47+
# Execute
48+
echo "⚙️ $build_cmd"
49+
eval $build_cmd
50+
51+
# Check
52+
if [ -f "$output_file" ]; then
53+
echo "✅ Built $output_file"
54+
else
55+
echo "❌ Failed to build $target"
56+
exit 1
57+
fi
58+
done
59+
60+
echo "🎉 All binaries built successfully and available in '$OUTPUT_DIR/'"
61+
285 KB
Loading
91.2 KB
Loading

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Monty-Hall-Problem-Simulator
2+
3+
go 1.20

0 commit comments

Comments
 (0)