Jump to content

Monty Hall problem: Difference between revisions

m
Line 414:
 
//if the next door has a goat, and the following door has a car, or vice versa, you'd win if you switch.
if(((!(door[((choice+1)%3)])) && (door[((choice+2)%3)])) || (!(door[((choice+2)%3)]) && (door[((choice+1)%3)]))) winsbyswitch++;
}
printf("\nAfter %u games, I won %u by switching. That is %f%%. ", GAMES, winsbyswitch, (float)winsbyswitch*100.0/(float)i);
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.