Christoffer Nygaard's Portfolio

Project: Blackjack (GUI)

Introduction


As my final study project was approaching I was wondering what I could do this year, as opposed to last year when I set up Windows servers and got that running. This year, however, I was left with the desire to go down the path of programming. Having only had 7 weeks of it in more or less my entire life, I was uncertain how this would unfold, but I also knew that it was among that and the SQL module, seeing as both of these were my favorite modules of any of these two years I studied. Don't get me wrong, I loved setting up servers also, but there's just something about programming that makes me happy. It's logical, and you keep seeing the progression all the time. Sure it can be frustrating at times when things don't work even if you, in your mind, believe that you've done everything according to the books... but all in all it's the things that do make you stronger.

Assignment


The assignment was to make a project where you could spend up to 7 weeks on doing something and then by the end hand in a report which had to consist up to 10 000 words and also do a presentation of it (in my case through Skype). I asked the teachers if they thought programming would be a good choice (considering the report part of it), and the reply I got was "Why not?", or at least that's the gist of it. I began thinking about what I wanted to make. I googled for recommended projects for a newbie within the given time and I did find a lot of alternatives, many of which I considered, but ended up on Blackjack for several reasons. One of the main reasons however was that it would give me a challenge when putting it into the GUI, but it's still simple enough so that I wouldn't take on way too much. My time with programming at this point was more or less only 7 weeks of basic knowledge, so while it seemed achievable, I was also very worried about the outcome.

Planning


Having decided that the project would be about Blackjack, and that I would put it into a GUI using wxWidgets, I started planning a head on what I should include and what I shouldn't. It's always a tough choice having to leave aspects behind, but it's all about time management and trying to get the right balance between getting a program up and running, and getting the report and presentation done in time. Looking at Blackjack rules I figured there really wasn't much point in the gambling aspect, since this program doesn't have any ways of taking in money or giving you back money. By cutting out gambling I decided to focus on a simpler design where you had Win, Loss and Draw. And example would be if two has the same score and no one has Blackjack, they draw and the third player lose.

I also decided to drop Double and Split, since I feel these are also more aimed at the gambling bit of it. Sure it can have it's advantages in a normal game also, at least Split, but again, I needed to prioritize. However, I wanted the dealer to play as autenthic as possible. So if a player has Blackjack, the dealer won't draw any more cards. If the dealer has 17, he won't draw any more cards. Also if both players bust he will be standing on the cards he has, no matter what they are.

So back to the coding plan of things. I decided that I wanted to create the program first in CLI, using C. This was because it would be easier to troubleshoot things in CLI and printing everything out into the console, rather than starting with it in GUI and having to use many extra elements to show the same information. I took things step by step and created the main functions of the game. The deck, the initializing, shuffling, dealing cards, and well, pretty much everything you needed. I also made a playable version in CLI, though it was dumbed down even further as it was more of a test to see if shuffling was good enough etc.

When the code was working as intended, I started working on the GUI that I had pre-designed in Photoshop, as an introduction to the project (something we needed to do in order to get the project approved). I tried to get it as close as possible to the original idea, and there was some limitations that made things a bit harder than I imagined, but all in all it's more or less the design I was aiming for. I did however have to drop the idea of selecting how many players (from 1-4), as I by this time was running out of time and I just wanted to present a working program on the day of the presentation. After many hours and days of frustration with wxWidgets, I ended up with a program that was exactly as I was hoping for, given the things I had decided to drop, and things were looking a lot brighter.

Conclusion


There's always stuff I would've wanted to do differently when looking back at it now, but all in all I thought it was a very solid project to do, and it was also a lot of fun to figure out how to do certain things, do them and get a result that, during the time you were working on it didn't think would be possible. I think this is why I love working with code this much, because I see improvement, I see progression and at the end of the day you have a result which very often is a lot better than anything you could've imagined yourself doing. It's that satisfaction that is the main fuel to this fire.

It made me even more happy when the presentation day came, and I could open the program and run it in front of the school - showing of a working version of a program I had used 5-7 weeks on coding and polishing to get to where it was. Some of the feedback I got was very nice, and all in all it just made me even more excited about the future. On top of it all, it was highlighted by the school together with an interview. All in all it's been fun and well worth the time and effort I put into it. I'm not sure if I'll continue working on it, but if I'll do I will definitely update it on this page.

Download


Version Number Compiled Date Download Link
Version 1.1 02.06.2016 (June build) Download

Screenshots


Player 1's turn

Player 2's turn

Dealer has done and he won. Scoreboard updates.

The menu choices you have, and it's shortcuts.