I have a project that is due on the 27th, and I have a strange glitch. As you can see from the code, I have a while loop that sets a variable based on certain conditions. But if you look at the console, it keeps on saying that the variable is the same, no matter how different the variables it depends on are.
This is my entire code:
var chance; // dont swap | swap
var prizeDoor;
var randomDoor;
var randomDoor2;
function setup() {
chance = 50;
createCanvas(1000, 1000);
}
function draw() {
//setting up round
prizeDoor = Math.round(random(1, 3));
//choosing first door
console.log("[1] [2] [3]");
randomDoor = Math.round(random(1, 3));
//showing user the door AI picks
if (randomDoor == 1) {
console.log(" ^");
console.log(" |");
} else if (randomDoor == 2) {
console.log(" ^");
console.log(" |");
} else {
console.log(" ^");
console.log(" |");
}
console.log("AI chooses door #" + randomDoor + ".");
//revealing a door
//getting a number that isnt the players door or the prize door
while ((!randomDoor2 == prizeDoor) || (!randomDoor2 == randomDoor)) {
randomDoor2 = Math.round(random(1, 3));
}
//showing this to the user
console.log("");
console.log("Door #" + randomDoor2 + " does not have the prize.");
}