Mel finally gave in and wrote the code,
but he got the test backwards,
and, when the sense switch was turned on,
the program would cheat, winning every time.
This doesn't sound like the sort of bug that occurs because you get a test backwards. Making a blackjack program that wins every time, and one that loses every time, seem like very different beasts. So what mistake did Mel make?
It seems pretty identical to me. In Blackjack, the easiest way to make someone win is to give them 21, and make sure no one else gets 21.
So if the pseudocode is something like:
if cheat_switch:
if active_player == "COMPUTER": #this should be "HUMAN"
make_current_player_get_21()
else:
make_current_player_get_20_or_busts()
Then the computer will always get 21, and the human player will get 20. Assume for the moment that it deals with dealing multiple cards for both the human and computer; this can be done, but isn't worth getting into.
And this could all be switched in the `active_player` check.
Along the same lines as some of the other responses, it's possible that the "test" in question was testing whether the affected player was the human or the computer; getting that particular test backwards would certainly have the described effect.