Adding Monty Hall problem

This commit is contained in:
gauvainboiche
2025-07-23 16:32:12 +02:00
parent 1026e526c9
commit d46e294ff3
3 changed files with 70 additions and 2 deletions

21
monty_hall.js Normal file
View File

@@ -0,0 +1,21 @@
const choices = {
choice0: false,
choice1: false,
choice2: false
};
const getRandomChoice = (max) => {
return Math.floor(Math.random() * max);
}
const setTrue = () => {
let randValue = getRandomChoice(3);
let key = `choice${randValue}`
choices[key] = true;
}
setTrue();
// let userChoice = prompt("Quelle porte choisissez-vous ? 1, 2 ou 3 ? ", 2);
if