Thursday, December 15, 2005
Last night I was digging through some old stuff of mine at my mom's house, and I stumbled upon the first windows program I ever wrote: BlackJack.
Back around 1995-1996, I was in high school and was wanting to learn computer programming. So, I bought myself a copy of the venerable Programming Windows 95 by Charles Petzold, and I decided to program a blackjack game.
These days, it seems almost everyone learns to program at one point or another with Visual Basic. It's interesting to me to think back to those days, because I know that I had never even *heard* of visual basic. All the programming classes that were offered were in Pascal. Either way, I decided that the way to program was with good old C.
I remember struggling quite a bit, because style of programming is certainly not "Add Button", "When I click on button, do this", as many VB programmers are accustomed to. On top of this, I truly was learning programming as well. For, not only was this my first Windows program, I do believe it was one of my first programs!
Take for instance this chuck of code:
// Register the window class.
if(!RegisterClassEx (&wcl)) return 0;
// Now that a window class has been registered,
// a window can be created.
hwnd = CreateWindow(
szWinName, // name of the window class
"Black Jack: v1", // title
WS_OVERLAPPEDWINDOW, // window style - normal
100, // x coordinate
50, // y coordinate
600, // width
450, // height
HWND_DESKTOP, // no parent window
NULL, // menu
hThisInst, // handle of this instance of the program
// Display the window
Here we are actually creating a window at the lowest level! These days with VB & even the .NET Framework, this stuff Just Works. This was non-trivial stuff.
I was pretty proud of my little program, so pround in fact that i packaged it all up with WinZip, added in installer, and released it on the internet. I even went so far as to print up lables with a logo and everything!
Now, granted the gameplay was not complex by any means, and there are a number of features missing. For instance, you can't split or double down, and BlackJacks don't pay 2-to-1, but all things considered, even looking back on it now with all the experience that I have, this is a sweet program! And addictive!
Not only did I release the program and the installer for free on the internet (which, I might add, was in it's infancy at the time), I also packaged up the source code and included it with the installation as well. I truly was open source before open source was coooool.
Take a look at the source code here.
For a true bit of nostalgia, here's the README file that is included in the thing...
README.TXT - Black Jack: v1 - By Dusty Davidson
Thank you for trying out my game. I hope that you will enjoy it. I know that it is not the type of game that you are going to get hours and hours of entertainment out of, but that's not really what I was aiming for.
This is my first game ever, along with my first Microsoft Windows program. It was a great learning experience for me, and I hope that I did everything correctly.
I have run the program through what seems like thousands of times, in search of bugs that might be there. I finally think that the game is as bug free as I can get it, but there might always be others that I have yet to come across. If you happen to run into a bug, please let me know. Either email me at firstname.lastname@example.org, or feel free to give me a call at (712) 325-****. That's all that I really ask for in return for the game.
If you want, check the website for future upgrades and updates to this program as well as any other programs that I might write. The address is: http://www.probe.net/~dustyd/dev.html
Thank you once again,
Isn't that fantastic?
You can download the BlackJack Installer here