An open API service indexing awesome lists of open source software.

https://github.com/brunos3d/monty-hall-game-simulation

A web-based implementation of the famous Monty Hall problem, a probability puzzle based on a game show scenario.
https://github.com/brunos3d/monty-hall-game-simulation

advent-of-code algorithms demo game playable statistics study

Last synced: about 1 year ago
JSON representation

A web-based implementation of the famous Monty Hall problem, a probability puzzle based on a game show scenario.

Awesome Lists containing this project

README

          

# Monty Hall Game Simulation

Welcome to the Monty Hall Game Simulation! This project is a web-based implementation of the famous Monty Hall problem, a probability puzzle based on a game show scenario. The simulation allows you to play the game interactively or run multiple iterations to see the statistical outcomes of different strategies.

## Table of Contents

- [Monty Hall Game Simulation](#monty-hall-game-simulation)
- [Table of Contents](#table-of-contents)
- [Introduction](#introduction)
- [Features](#features)
- [Live Game](#live-game)
- [How to Play](#how-to-play)
- [Simulation](#simulation)
- [Technologies Used](#technologies-used)
- [Setup](#setup)
- [License](#license)

## Introduction

The Monty Hall problem is a probability puzzle named after the host of the television game show "Let's Make a Deal." In this game, a contestant is presented with three doors. Behind one door is a car (the prize), and behind the other two doors are goats. The contestant selects one door, and then the host, who knows what is behind each door, opens one of the other two doors to reveal a goat. The contestant is then given the option to switch their choice to the remaining unopened door or stick with their original choice. The puzzle is to determine whether the contestant should switch or stay to maximize their chances of winning the car.

## Features

- **Interactive Gameplay**: Select a door and play the game once to see if you win the car.
- **Auto Play Simulation**: Run multiple iterations of the game to see the statistical outcomes of staying versus switching.
- **Visual Feedback**: Highlight the selected door and display results in a console area.

## Live Game

You can play the live game [here](https://brunos3d.github.io/monty-hall-game-simulation/).

## How to Play

1. **Select a Door**: Click on one of the three doors to make your choice.
2. **Play Once**: Click the "Play Once" button to see if you win the car by staying with your choice.
3. **Auto Play**: Enter the number of iterations and click the "Auto Play" button to run the simulation and see the win rates for staying and switching.

## Simulation

The simulation runs multiple iterations of the Monty Hall game to calculate the win rates for two strategies:

- **Staying with the initial choice**.
- **Switching to the other door after the host reveals a goat**.

The results are displayed in the console area, showing the win rates for both strategies.

## Technologies Used

- **HTML**: Structure of the web page.
- **CSS**: Styling of the web page.
- **JavaScript**: Game logic and interactivity.

## Setup

To run this project locally, follow these steps:

1. Clone the repository:
```sh
git clone https://github.com/brunos3d/monty-hall-game.git
```
2. Navigate to the project directory:
```sh
cd monty-hall-game
```
3. Open `index.html` in your web browser.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

Enjoy playing and exploring the Monty Hall problem with this interactive simulation! If you have any questions or feedback, feel free to reach out.

Happy gaming! 🎉

---