Every now and then I like to give myself a fun little programming challenge. I'll randomly pick some enjoyable task, like programming a game or blogging engine or what not, and impose a time limit, anywhere from an hour to an afternoon. Such little challenges keep the fun in programming and help me mentally recharge. After spending a week of programming boring data entry forms, such toy projects help remind me why I enjoy computer science and programming!
Anyway, a few months ago I decided to see if I couldn't create a simple online Blackjack game that would allow a single person to come to the site, enter their name and starting bank role, and play Blackjack against a dealer. If you're interested in checking out this little toy application, the result of an afternoon of enjoyable coding, you can download the complete source code from here. There's also a light 4Guys article that provides some light details on the code, Creating a Quick and Dirty Online Blackjack Game.
If you decide to download and poke through this application, please do bear in mind that it was purposefully rushed, as I was racing against the clock to complete the project. Consequently, the code may be rather tattered in places, there are likely many spots where it should be refactored, and there are next to no comments. Let's just say that it's not a showcase of 'best practices', unless you're MacGyver and need to program a blackjack game in under four hours or a nuclear missle is going to explode.
See the BlackjackWikipedia entry for rules and basic strategy.