So my assignment is to solve the monty hall problem, which i am sure you guys know already. Here's my code so far, and I'll explain where did I got stuck
#include <iostream>
#include <fstream>
using namespace std;
typedef int Door;
const int SIMULATION_COUNT = 100;
void simulate( ... );( given by professor)
Door hideCar();
Door openDoor();
Door makeFirstChoice();
Door makeSecondChoice();
int hideCar()
{
return 1 + rand() % 3;
}
int makeFirstChoice()
{
return 1 + rand() % 3;
}
after the first choice, Monty are suppose to "open" one other door of the remaining doors. And I am not sure how to do that. Any help will be appreciated, thanks!
As funny as it sounds: The open door is irrelevant:
Pseudo code:
win_door = 1,2,3
choice_door = 1,2,3
stick_to_your_choice = 0,1
if stick_to_your_choice
if win_door == choice_door
You win
else
You loose
else
if win_door == choice_door
You loose
else
You win