Goat or Car? Game Show Simulator

A player is presented with three doors. Behind one door is a new car. The other two doors conceal a goat. The player chooses a door then the host reveals a goat behind one of the two remaining doors. Should the player maintain his choice or switch to the only remaining door?

My intuition suggested that once the other goat was revealed that it became a simple 50% chance that the player had chosen correctly and, therefore, there would be no statistical benefit in changing their mind. In the simulation below, the player always sticks with their original choice.

Player won 3 times and lost 7 times.

  1. Goat
  2. Goat
  3. Goat
  4. Goat
  5. Car
  6. Goat
  7. Car
  8. Goat
  9. Car
  10. Goat

Every refresh of this page runs the test again so you will see variation in results. Of course, 10 iterations are statistically insignificant. A simulation of 1,000 iterations makes the ratio clearer:

Player won 337 times and lost 663 times.

  1. Goat
  2. Goat
  3. Car
  4. Car
  5. Goat
  6. Goat
  7. Car
  8. Car
  9. Goat
  10. Goat
  11. Car
  12. Car
  13. Goat
  14. Goat
  15. Car
  16. Car
  17. Goat
  18. Goat
  19. Car
  20. Car
  21. Car
  22. Goat
  23. Goat
  24. Goat
  25. Goat
  26. Goat
  27. Goat
  28. Goat
  29. Goat
  30. Car
  31. Goat
  32. Goat
  33. Goat
  34. Car
  35. Goat
  36. Car
  37. Goat
  38. Goat
  39. Goat
  40. Goat
  41. Car
  42. Goat
  43. Goat
  44. Goat
  45. Car
  46. Goat
  47. Goat
  48. Car
  49. Car
  50. Goat
  51. Goat
  52. Goat
  53. Goat
  54. Car
  55. Car
  56. Car
  57. Goat
  58. Goat
  59. Goat
  60. Goat
  61. Goat
  62. Goat
  63. Goat
  64. Goat
  65. Goat
  66. Goat
  67. Goat
  68. Goat
  69. Goat
  70. Goat
  71. Car
  72. Goat
  73. Goat
  74. Car
  75. Car
  76. Goat
  77. Car
  78. Goat
  79. Goat
  80. Goat
  81. Car
  82. Goat
  83. Goat
  84. Goat
  85. Goat
  86. Car
  87. Goat
  88. Goat
  89. Car
  90. Goat
  91. Goat
  92. Car
  93. Goat
  94. Car
  95. Goat
  96. Goat
  97. Goat
  98. Goat
  99. Goat
  100. Goat
  101. Goat
  102. Goat
  103. Goat
  104. Goat
  105. Goat
  106. Car
  107. Goat
  108. Goat
  109. Goat
  110. Car
  111. Car
  112. Goat
  113. Goat
  114. Car
  115. Car
  116. Goat
  117. Goat
  118. Car
  119. Car
  120. Goat
  121. Goat
  122. Car
  123. Goat
  124. Car
  125. Goat
  126. Goat
  127. Goat
  128. Goat
  129. Goat
  130. Goat
  131. Goat
  132. Goat
  133. Goat
  134. Goat
  135. Goat
  136. Goat
  137. Goat
  138. Car
  139. Car
  140. Goat
  141. Goat
  142. Goat
  143. Goat
  144. Goat
  145. Car
  146. Car
  147. Car
  148. Goat
  149. Goat
  150. Goat
  151. Goat
  152. Car
  153. Goat
  154. Goat
  155. Goat
  156. Goat
  157. Goat
  158. Goat
  159. Goat
  160. Car
  161. Goat
  162. Goat
  163. Car
  164. Car
  165. Car
  166. Goat
  167. Goat
  168. Car
  169. Goat
  170. Goat
  171. Goat
  172. Goat
  173. Goat
  174. Goat
  175. Car
  176. Goat
  177. Goat
  178. Car
  179. Goat
  180. Goat
  181. Car
  182. Goat
  183. Car
  184. Car
  185. Goat
  186. Goat
  187. Goat
  188. Car
  189. Goat
  190. Goat
  191. Goat
  192. Goat
  193. Goat
  194. Goat
  195. Car
  196. Goat
  197. Goat
  198. Goat
  199. Goat
  200. Goat
  201. Goat
  202. Car
  203. Goat
  204. Goat
  205. Goat
  206. Goat
  207. Goat
  208. Car
  209. Car
  210. Goat
  211. Car
  212. Goat
  213. Goat
  214. Car
  215. Goat
  216. Goat
  217. Car
  218. Goat
  219. Car
  220. Car
  221. Goat
  222. Goat
  223. Car
  224. Goat
  225. Goat
  226. Car
  227. Goat
  228. Car
  229. Goat
  230. Car
  231. Car
  232. Goat
  233. Goat
  234. Goat
  235. Goat
  236. Goat
  237. Goat
  238. Car
  239. Goat
  240. Goat
  241. Goat
  242. Goat
  243. Goat
  244. Car
  245. Goat
  246. Car
  247. Car
  248. Goat
  249. Goat
  250. Goat
  251. Goat
  252. Goat
  253. Goat
  254. Goat
  255. Goat
  256. Car
  257. Car
  258. Car
  259. Car
  260. Goat
  261. Car
  262. Car
  263. Car
  264. Car
  265. Goat
  266. Goat
  267. Car
  268. Goat
  269. Goat
  270. Goat
  271. Car
  272. Goat
  273. Goat
  274. Goat
  275. Car
  276. Goat
  277. Car
  278. Goat
  279. Car
  280. Car
  281. Car
  282. Goat
  283. Goat
  284. Goat
  285. Goat
  286. Car
  287. Goat
  288. Goat
  289. Goat
  290. Goat
  291. Goat
  292. Car
  293. Goat
  294. Car
  295. Goat
  296. Goat
  297. Goat
  298. Car
  299. Car
  300. Car
  301. Goat
  302. Goat
  303. Goat
  304. Goat
  305. Goat
  306. Car
  307. Goat
  308. Goat
  309. Goat
  310. Goat
  311. Goat
  312. Goat
  313. Goat
  314. Car
  315. Goat
  316. Car
  317. Goat
  318. Goat
  319. Goat
  320. Goat
  321. Car
  322. Goat
  323. Goat
  324. Goat
  325. Goat
  326. Goat
  327. Car
  328. Car
  329. Goat
  330. Car
  331. Car
  332. Car
  333. Car
  334. Goat
  335. Goat
  336. Car
  337. Car
  338. Car
  339. Car
  340. Car
  341. Goat
  342. Goat
  343. Goat
  344. Goat
  345. Goat
  346. Car
  347. Goat
  348. Goat
  349. Goat
  350. Goat
  351. Goat
  352. Car
  353. Goat
  354. Goat
  355. Goat
  356. Goat
  357. Goat
  358. Goat
  359. Goat
  360. Goat
  361. Goat
  362. Goat
  363. Goat
  364. Car
  365. Goat
  366. Goat
  367. Car
  368. Goat
  369. Car
  370. Goat
  371. Goat
  372. Goat
  373. Goat
  374. Goat
  375. Car
  376. Goat
  377. Goat
  378. Goat
  379. Goat
  380. Car
  381. Car
  382. Goat
  383. Goat
  384. Goat
  385. Goat
  386. Car
  387. Car
  388. Goat
  389. Car
  390. Goat
  391. Car
  392. Car
  393. Goat
  394. Car
  395. Goat
  396. Car
  397. Goat
  398. Goat
  399. Car
  400. Goat
  401. Goat
  402. Car
  403. Car
  404. Goat
  405. Car
  406. Goat
  407. Goat
  408. Car
  409. Goat
  410. Goat
  411. Car
  412. Goat
  413. Goat
  414. Goat
  415. Goat
  416. Goat
  417. Car
  418. Goat
  419. Car
  420. Goat
  421. Goat
  422. Goat
  423. Goat
  424. Car
  425. Goat
  426. Car
  427. Car
  428. Car
  429. Goat
  430. Goat
  431. Goat
  432. Goat
  433. Goat
  434. Car
  435. Goat
  436. Car
  437. Goat
  438. Goat
  439. Car
  440. Car
  441. Goat
  442. Car
  443. Goat
  444. Goat
  445. Goat
  446. Goat
  447. Goat
  448. Goat
  449. Goat
  450. Goat
  451. Goat
  452. Car
  453. Goat
  454. Goat
  455. Goat
  456. Car
  457. Goat
  458. Goat
  459. Car
  460. Car
  461. Car
  462. Goat
  463. Goat
  464. Car
  465. Goat
  466. Car
  467. Goat
  468. Goat
  469. Goat
  470. Goat
  471. Car
  472. Goat
  473. Car
  474. Goat
  475. Goat
  476. Goat
  477. Goat
  478. Goat
  479. Goat
  480. Goat
  481. Goat
  482. Goat
  483. Car
  484. Car
  485. Goat
  486. Goat
  487. Goat
  488. Goat
  489. Car
  490. Goat
  491. Goat
  492. Goat
  493. Car
  494. Goat
  495. Car
  496. Car
  497. Car
  498. Goat
  499. Car
  500. Goat
  501. Goat
  502. Car
  503. Car
  504. Goat
  505. Goat
  506. Goat
  507. Car
  508. Goat
  509. Car
  510. Goat
  511. Goat
  512. Goat
  513. Goat
  514. Goat
  515. Goat
  516. Goat
  517. Goat
  518. Goat
  519. Goat
  520. Goat
  521. Goat
  522. Car
  523. Goat
  524. Car
  525. Goat
  526. Goat
  527. Goat
  528. Car
  529. Goat
  530. Goat
  531. Goat
  532. Car
  533. Goat
  534. Goat
  535. Goat
  536. Goat
  537. Goat
  538. Goat
  539. Goat
  540. Car
  541. Car
  542. Goat
  543. Goat
  544. Car
  545. Goat
  546. Goat
  547. Goat
  548. Goat
  549. Goat
  550. Car
  551. Car
  552. Goat
  553. Goat
  554. Car
  555. Goat
  556. Goat
  557. Car
  558. Goat
  559. Car
  560. Goat
  561. Goat
  562. Car
  563. Goat
  564. Goat
  565. Goat
  566. Car
  567. Car
  568. Car
  569. Goat
  570. Car
  571. Car
  572. Goat
  573. Car
  574. Car
  575. Goat
  576. Goat
  577. Goat
  578. Goat
  579. Car
  580. Car
  581. Goat
  582. Goat
  583. Goat
  584. Car
  585. Car
  586. Car
  587. Goat
  588. Goat
  589. Goat
  590. Goat
  591. Goat
  592. Goat
  593. Car
  594. Goat
  595. Goat
  596. Goat
  597. Car
  598. Goat
  599. Goat
  600. Goat
  601. Goat
  602. Car
  603. Goat
  604. Goat
  605. Goat
  606. Car
  607. Car
  608. Goat
  609. Car
  610. Car
  611. Car
  612. Goat
  613. Goat
  614. Car
  615. Goat
  616. Goat
  617. Car
  618. Goat
  619. Car
  620. Goat
  621. Car
  622. Goat
  623. Car
  624. Goat
  625. Goat
  626. Goat
  627. Goat
  628. Goat
  629. Goat
  630. Goat
  631. Goat
  632. Goat
  633. Goat
  634. Car
  635. Goat
  636. Goat
  637. Goat
  638. Car
  639. Goat
  640. Car
  641. Goat
  642. Goat
  643. Car
  644. Goat
  645. Car
  646. Goat
  647. Car
  648. Goat
  649. Car
  650. Goat
  651. Goat
  652. Goat
  653. Car
  654. Car
  655. Car
  656. Car
  657. Car
  658. Car
  659. Goat
  660. Goat
  661. Goat
  662. Car
  663. Car
  664. Car
  665. Car
  666. Car
  667. Car
  668. Car
  669. Goat
  670. Car
  671. Goat
  672. Car
  673. Goat
  674. Car
  675. Goat
  676. Goat
  677. Goat
  678. Car
  679. Car
  680. Goat
  681. Car
  682. Goat
  683. Goat
  684. Car
  685. Goat
  686. Car
  687. Goat
  688. Goat
  689. Goat
  690. Car
  691. Car
  692. Goat
  693. Car
  694. Goat
  695. Goat
  696. Car
  697. Goat
  698. Goat
  699. Car
  700. Goat
  701. Goat
  702. Goat
  703. Goat
  704. Goat
  705. Car
  706. Goat
  707. Car
  708. Goat
  709. Goat
  710. Car
  711. Goat
  712. Goat
  713. Goat
  714. Goat
  715. Goat
  716. Car
  717. Car
  718. Goat
  719. Goat
  720. Goat
  721. Car
  722. Goat
  723. Car
  724. Goat
  725. Goat
  726. Goat
  727. Goat
  728. Car
  729. Goat
  730. Goat
  731. Car
  732. Goat
  733. Goat
  734. Car
  735. Goat
  736. Car
  737. Goat
  738. Goat
  739. Goat
  740. Goat
  741. Goat
  742. Goat
  743. Car
  744. Goat
  745. Goat
  746. Car
  747. Goat
  748. Car
  749. Goat
  750. Car
  751. Car
  752. Goat
  753. Car
  754. Goat
  755. Goat
  756. Car
  757. Goat
  758. Car
  759. Goat
  760. Car
  761. Goat
  762. Goat
  763. Goat
  764. Goat
  765. Goat
  766. Goat
  767. Car
  768. Car
  769. Car
  770. Goat
  771. Car
  772. Goat
  773. Car
  774. Car
  775. Car
  776. Goat
  777. Car
  778. Goat
  779. Goat
  780. Car
  781. Goat
  782. Goat
  783. Goat
  784. Goat
  785. Car
  786. Goat
  787. Goat
  788. Car
  789. Goat
  790. Goat
  791. Car
  792. Goat
  793. Goat
  794. Goat
  795. Goat
  796. Goat
  797. Goat
  798. Goat
  799. Goat
  800. Car
  801. Goat
  802. Car
  803. Goat
  804. Goat
  805. Car
  806. Goat
  807. Goat
  808. Car
  809. Goat
  810. Car
  811. Goat
  812. Goat
  813. Goat
  814. Car
  815. Goat
  816. Car
  817. Goat
  818. Car
  819. Car
  820. Goat
  821. Goat
  822. Goat
  823. Goat
  824. Goat
  825. Goat
  826. Goat
  827. Goat
  828. Goat
  829. Goat
  830. Car
  831. Goat
  832. Goat
  833. Goat
  834. Goat
  835. Car
  836. Goat
  837. Goat
  838. Goat
  839. Goat
  840. Car
  841. Car
  842. Goat
  843. Car
  844. Goat
  845. Goat
  846. Car
  847. Car
  848. Goat
  849. Goat
  850. Goat
  851. Goat
  852. Goat
  853. Car
  854. Car
  855. Goat
  856. Car
  857. Goat
  858. Goat
  859. Goat
  860. Goat
  861. Car
  862. Goat
  863. Goat
  864. Goat
  865. Goat
  866. Goat
  867. Goat
  868. Car
  869. Goat
  870. Goat
  871. Goat
  872. Car
  873. Car
  874. Goat
  875. Goat
  876. Car
  877. Goat
  878. Goat
  879. Car
  880. Car
  881. Goat
  882. Goat
  883. Car
  884. Car
  885. Goat
  886. Car
  887. Goat
  888. Goat
  889. Car
  890. Goat
  891. Goat
  892. Goat
  893. Goat
  894. Goat
  895. Car
  896. Goat
  897. Goat
  898. Car
  899. Goat
  900. Goat
  901. Goat
  902. Goat
  903. Goat
  904. Car
  905. Car
  906. Car
  907. Car
  908. Goat
  909. Car
  910. Goat
  911. Car
  912. Goat
  913. Goat
  914. Goat
  915. Goat
  916. Goat
  917. Goat
  918. Goat
  919. Goat
  920. Goat
  921. Goat
  922. Goat
  923. Goat
  924. Goat
  925. Goat
  926. Car
  927. Car
  928. Car
  929. Car
  930. Car
  931. Car
  932. Goat
  933. Car
  934. Goat
  935. Car
  936. Goat
  937. Goat
  938. Goat
  939. Car
  940. Goat
  941. Goat
  942. Goat
  943. Goat
  944. Goat
  945. Goat
  946. Car
  947. Car
  948. Goat
  949. Goat
  950. Car
  951. Car
  952. Car
  953. Car
  954. Goat
  955. Car
  956. Goat
  957. Goat
  958. Goat
  959. Goat
  960. Car
  961. Goat
  962. Car
  963. Goat
  964. Goat
  965. Car
  966. Goat
  967. Car
  968. Goat
  969. Car
  970. Goat
  971. Car
  972. Goat
  973. Goat
  974. Goat
  975. Car
  976. Goat
  977. Car
  978. Goat
  979. Car
  980. Goat
  981. Car
  982. Goat
  983. Car
  984. Goat
  985. Car
  986. Goat
  987. Car
  988. Goat
  989. Goat
  990. Car
  991. Car
  992. Goat
  993. Goat
  994. Goat
  995. Goat
  996. Car
  997. Car
  998. Goat
  999. Goat
  1000. Goat

But what if there were 10 doors with nine goats and one car? The game would still work the same where the player picks one door, and the host reveals 8 goats. Should the player switch? Here is a 1,000 iteration simulation where there are 10 doors and the player always sticks with their original choice:

Player won 103 times and lost 897 times.

So clearly, the number of doors influences the probability that the player would be better of by switching to the other remaining door.

Would you like to run a simulation? Enter your variables below:

How many doors?

How many iterations?

Should the player stay with their original choice?
Yes     No

Show images?
Yes     No

Custom test result

Player won 26 times and lost 74 times.

Methodology

This page uses the following PHP function to run the simulations:

function runTest($iterations, $number_of_doors=3, $player_stays=true, $show_pictures=false){

	// sanitize iterations
	$iterations = (int) preg_replace("/[^0-9]/","",$iterations);
	$iterations = ($iterations < 1)? 10 : $iterations;
	$iterations = ($iterations > 10000)? 10000 : $iterations;

	// sanitize number_of_doors
	$number_of_doors = (int) preg_replace("/[^0-9]/","",$number_of_doors);
	$number_of_doors = ($number_of_doors < 3)? 3 : $number_of_doors;
	$number_of_doors = ($number_of_doors > 10000)? 10000 : $number_of_doors;

	// generate a standard array
	$doors_original[0] = 'car';
	for($i=1; $i < $number_of_doors ; $i++){
		$doors_original[$i] = 'goat';
	}
	
	// initialize our scores
	$losses = 0; $wins = 0;
	
	// decide how big the images will be
	if($iterations >= 1000){
		$size = '24';
	} else if($iterations >= 100){
		$size = '32';
	} else {
		$size = '64';
	}
	
	$output = '<ol>';
	for($i=0; $i<$iterations; $i++){
		// make a temporary copy for this usage
		$doors = $doors_original;
		
		// shuffle the array
		shuffle($doors);
		
		// player always picks door number 1
		$players_first_choice = $doors[0];
		
		// did the player win?
		if($players_first_choice == 'car' && $player_stays==true){
			$output .= '<li class="c'.$size.'"><b>Car</b></li>';
			$wins++;
		} else if($players_first_choice == 'goat' && $player_stays==true){
			$output .= '<li class="g'.$size.'"><i>Goat</i></li>';
			$losses++;
		} else if($players_first_choice == 'car' && $player_stays==false){
			$output .= '<li class="g'.$size.'"><i>Goat</i></li>';
			$losses++;
		} else if($players_first_choice == 'goat' && $player_stays==false){
			$output .= '<li class="c'.$size.'"><b>Car</b></li>';
			$wins++;
		}
	}
	$output .= '</ol><div class="clear"> </div>';
	
	echo '<h3>Player won '.$wins.' time'.(($wins >1)? 's':'').
	     ' and lost '.$losses.' time'.(($losses >1)? 's':'').'.</h3>';
	if($show_pictures){
		echo $output;
	}
}