-There's a 1/100 chance my door is a car, in which case it doesn't matter which of the others stays closed, it will always be a goat. The game will proceed, and switching will lose.
-There's a 99/100 chance my door is a goat, in which case the car is behind some other door. Choosing 98 out of 99 doors to open at random is the same as choosing 1 out of 99 doors to leave closed at random. So the chance that the car stays hidden in this case (so that switching will win) is 1/99, and 98/99 that the game ends early because the car is revealed.
-Adding it up, the game ends without the chance to make a choice 99/100 * 98/99 = 98/100 of the time. Of the remaining 2%, 1/100 comes from the first case (switching loses) and 99/100 * 1/99 = 1/100 comes from the second case (switching wins). The strategies are equally effective.
That's exactly the point. If he doesn't know, then it's exactly 50/50 and there is no reason to switch. If he does know, then it's 1/NUM_DOORS versus NUM_DOORS-1/NUM_DOORS, so you'd be crazy not to switch.
The point is, if he picks at random, in the 100 door case, the vast majority of the time he will open the car door while opening those 98 doors. The case where you get to pick again would be exceedingly rare. Conversely, if he only opens goat doors, you will get your second pick 100% of the time.
So you thought that eliminating them you were left with the original 1/3 vs 2/3, when you actually removed half of the 2/3.
Edit: having written this, thinking about the 100 door case. If 98 random doors open (that aren't the one I picked) then the fact they all contain goats is pretty suggestive that I have the car, or at least 50/50. I'm not convinced by the code example though.