CS:GO - Monty Hall problem simulator demonstration and explanation
Channel: sn0wsh00
Date: 2021-03-15

Quick demonstration video of a Monty Hall problem simulator I created in CS:GO, along with a simplified visual explanation of how this was created in Valve Hammer (NOT an explanation of the Monty Hall problem itself). 

This Monty Hall problem simulator can be found on my map AM_Munitions_Cache:
https://steamcommunity.com/sharedfiles/filedetails/?id=2412096868

Visualized map download:
https://drive.google.com/file/d/1DCv7EHPKeRGT6u468PGjbJzDMxKhkyik/view?usp=sharing

Music:
https://gloomguardian.bandcamp.com/album/stay-or-switch

Other videos in the CS:GO Monty Hall Problem Simulator Tetralogy: 
https://youtu.be/33SHFPCtFRU
https://youtu.be/aPVtbFiB9Y8
https://youtu.be/yC12psYKGuU

--How this was made in Valve Hammer, with timestamps--
1:08 Modified map that visually shows the logic entity relations for the Monty Hall problem simulator. The delays in this map have been exaggerated so these relations can be more easily seen.

1:38 Each button has a corresponding pair of logic_branch and logic_compare entities. The logic_branches tells the map which button is eligible to be burned after the first press, while the logic_compares will determine whether or not the player used a safe button during the second press. Both logic_branch and logic_compress have initial values of 1, while the logic_compare also has a compare value of 1. Before a player presses a button, the map, via a logic_case, chooses which button will be the button that'll open the door by disabling a button's corresponding logic_branch and logic_compare entities. To disable these entities, the map sets logic_branch's initial value to 0 and logic_compare's compare value (which, remember, is separate from logic_compare's initial value) to 0 (false). 

1:50 When a player uses a button the first time, the button adds 1 to a math_counter entity (which I will name press_1st_counter) and disables (i.e. sets false) the button's corresponding logic_branch. In the video, because the player had pressed the door-opening button the first time, there was no logic_branch to disable. 

2:00 Press_1st_counter has a maximum legal value of 1 and only activates when the first press (and only the first press) occurs. When the first press occurs, the math_counter sends out a Test output to the logic_branch entities. In the video, the term "remaining" refers to logic_branch entities whose initial value remained 1 (true). 

2:05 Now we're at the step that prevents the map from igniting the button the player originally picked. When the logic_branches receive the Test input from Press_1st_counter, all logic_branches whose value is still true will send an AddOutput command to an empty logic_case entity. These AddOutput commands add cases to the empty logic_case entity, essentially building a logic_case from scratch. In the video, the middle and right logic_branches are the ones send out doing the AddOutput stuff, generating two new cases in the empty logic_case entity. Had the player chose the say the middle button first, then only one case would be added to the logic_case

2:12 With a newly assembled logic_case entity, we can now send a PickRandom command to that formerly empty logic_case entity, which will randomly choose a button to burn.

2:19 In addition to a logic_compare entity, each button also has a corresponding math_counter entity (not shown) that activates on the second press. On the second press, this math_counter entity sets the logic_compare's initial value (NOT the compare value) to 0 and then compares the initial value to the compare value. If they are equal, logic_compare will open the door. Otherwise, logic_compare sets the button on fire. Remember, the logic_case at the start of the round is in charge of determining whether to set a logic_compare's compare value to false.