So I mentioned in another thread that I used nekochan's prodigious downtime to get started on something I've wanted to do since forever, which is to recreate the pioneering blackjack simulations that were done by Julian Braun at IBM in the 1960s and published in Lawrence Revere's classic 1969 book "Playing Blackjack as a Business." Braun did his sims in fortran and later wrote several papers and a book or two about it, but he died rather suddenly in 2000 and his source code is apparently lost for all time.
Anyway I thought I'd do the simplest simulation first, which is how many times a player will get each dealt hand versus the dealer's up card in 100,000 hands. I wanted to watch the numbers click up in real time so I called XtSetValues each time a hand was dealt, and to make sure each widget updated on the screen immediately I called XFlush after every deal. It didn't work. if you want to make X crawl, if you want to make X puke and
die
just call XtSetValues a hundred thousand times. Actually, it's not the calls themselves, they go into the server queue and complete pretty fast, it's the server trying to update the widgets that kills it. On my 3.2 GHz Linux box, it takes several
minutes
for the server to work it's way through the queue. No wonder the Unix Hater's Manual has a chapter titled The X Windows Disaster. So yeah, this isn't going to work and I've got to try something else. But if you'd like to witness the hilarity, source code is attached. I haven't tried this on IRIX yet but since I haven't done anything with X resources it uses the motif defaults which on IRIX always look like
da sheet.
Oh, and I haven't coded the line for the totals on the bottom either. So what you see is the player's two card totals down the left side versus the dealer's upcard at the top, and how many times you will get each hand in 100,000 deals. Braun ran the simulation innumerable times and then averaged them, which is what I'll do too eventually. So if you've read all the way to the end of this ridiculously long post, thanks! Post back if you actually try this. Compilation instructions are at the top of the file...