The Story of Mel Explained
jamesseibel.com
jamesseibel.com
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? If SENSE SWITCH 32 is depressed, there is a better than normal chance
of an ace being dealt as the player's first card.
Presumably the story didn't get that quite right. Sadly the code hasn't turned up.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.
Mel's story is nuts but from the perspective of today (or even when I started in 1981) but you have to start somewhere and you can't judge what people did in the early days except in the context of the times.
Reading this made me thing of some of the crazy tricks I've pulled in TIS-100. And while it worked well in a game, it would be a nightmare for that to be my day job.
It sounds to me like he should have been writing optimizing assemblers instead of wasting his talents doing one-off blackjack programs.
Additionally, Real Programmers write comprehensible code.
"Real Programmer" is derived from the name of Real Programmers Don't Use Pascal [0], which describes "Real Programmers" as being those who use FORTRAN or assembly or something similarly painful to write software in versus someone who used high-level languages. Nowadays it's generally understood to mean anyone who writes code either directly on "bare metal" or very close to it despite the use of higher-level tools; nowadays, the term's used more-or-less ironically (since modern compilers have gotten much better about proper optimizations), but Mel Kaye - the "Mel" of "The Story of Mel" - was (is?) the archetypal definition of a true "Real Programmer".
The term "Real Programmer" predates "The Story of Mel" by about a year; "The Story of Mel" was written as a direct response to "Real Programmers Don't Use Pascal" (namely, its claim that "Real Programmers write in FORTRAN"). Mel makes FORTRAN programmers look like quiche-eating Pascal programmers in comparison.
[0]: https://en.wikipedia.org/wiki/Real_Programmers_Don%27t_Use_P...
For everyone else, though, it's part of the Jargon File: http://www.catb.org/jargon/html/story-of-mel.html
You should think that self-modifying code has died out by today, but far from it. Each time you open a web site, you could watch this old trick at work. How often do you `document.write` on a web site? To put it without diplomacy, our webware today is at the level of programming an IBM 650 with magnetic drum memory, where self-modifying code is practically mandatory. And Mel is nowhere to be found.
<script>
// Load optimized or debug code.
if (debugMode) {
document.write('<script src="build-debug.js"></script>');
} else {
document.write('<script src="build-opt.js"></script>');
}
// Enable some runtime debug flags.
if (enableTracing) {
// This runs *after* loading the script above and
// before main() is called below.
document.write('<script>ENABLE_TRACING = true;</script>');
}
</script>
<script>
// This runs *after* the script tags injected in the section above.
main();
</script>What Mel was doing is the equivalent of document.edit.
I read this as a story of "coming out" on Usenet... thought it was going to be about sexual/gender identity or something.