blackjack
#1
blackjack
I posted this on nekochan years ago. At one time it was my intent to recreate all the simulations that Julian Braun of IBM corporation did to support Lawrence Revere's book "Playing Blackjack as a Business," but so far the only one I've recreated is Braun's simulation of how many times a player will be dealt each possible hand versus every possible dealer's upcard in one million hands of blackjack. So, in this simulation the player's two card hand is down the left column, the dealer's up card is the top row. The code Braun wrote for his simulations is lost to history, but I know he coded in Fortran. I assume he ran the million hand simulation many, many times and then averaged the result. My simulation doesn't do that, but you can run it as many times as you like. If you run it too many times you'll overflow the widget size that holds the numbers. Motif will resize it's widgets to fit the number it's supposed to hold, but if you use that feature it is SLOW SLOW SLOW, so in this simulation it's turned off and all the widgets are hard coded to a size that never changes. This runs really fast on my Linux box but molasses slow on my Octane2, which has 8 gig of ram and two 600MHz R16000's. Oh well. Tips on compiling are at the top of the file. If you choose to compile and run this, thanks. If not, thanks anyway! Tongue


Attached Files
.gz braun04.cpp.gz Size: 18.93 KB  Downloads: 205

Project: Temporarily lost at sea
Plan: World domination! Or something...
vishnu
Tezro, Octane2, 2 x Onyx4

Trade Count: (0)
Posts: 1,245
Threads: 41
Joined: Dec 2017
Location: Minneapolis, Minnesota USA
Find Reply
10-09-2019, 04:45 AM
#2
RE: blackjack
Compiling this with:

Code:
g++ -Wall -pedantic -W -ggdb braun04.cpp -o braun -lXm -lXt -lX11 -lXmu

and running this on my Ubuntu 1804 box, i do see some numbers in the table but after a little while i get:

Code:
$ ./braun
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)
So this still needs a bit of debugging.

If i add "-g" to the compile flags it actually runs for quite a while. How do i stop it? Smile
dexter1
Administrator

Trade Count: (1)
Posts: 297
Threads: 17
Joined: May 2018
Location: The Netherlands
Find Reply
10-15-2019, 09:57 PM
#3
RE: blackjack
Sorry Dex, I didn't see this til just now! You don't need to add -g, -ggdb does the same thing. On my dual core Slackware box with 8 gig of ram it takes 15 seconds to complete it's run of a million hands, and uses about 275K of ram. What happens if you run it in the debugger? Do `gdb braun` and once it's loaded type `run` and it should tell you exactly which line of code it's crashing on or what library on your system it's crashing in. I don't have a "stop" button implemented yet so to kill it, with the window it's running in selected just do "control c" (or kill -9 its process ID). I suspect it's a problem with Ubuntu's version of Motif, I'm using Motif 2.1.32 that I compiled myself. Motif 2.3 and 2.4 have some serious issues...

Project: Temporarily lost at sea
Plan: World domination! Or something...
(This post was last modified: 10-24-2019, 02:37 AM by vishnu.)
vishnu
Tezro, Octane2, 2 x Onyx4

Trade Count: (0)
Posts: 1,245
Threads: 41
Joined: Dec 2017
Location: Minneapolis, Minnesota USA
Find Reply
10-24-2019, 02:33 AM


Forum Jump:


Users browsing this thread: 1 Guest(s)