Friday, 22 July 2011

MateriaDevs: C# Blackjack

As you may or may not know, as well as being passionate about the games industry, I also wish to work within it in future. I have a particular interest in the Indie Development scene, and ideally would like to become involved in it myself at some point. This means I have spent a lot of time over the past few years learning programming languages and such. With the MateriaDevs feature, I would like to show off a few of my own creations, old and new. A lot of these features will include a little bit of technical information about the program, and so if you have no interest in programming or the development process of video games - these sections may not be for you. This first entry is for a very old project of mine, in fact it was my first with the C# programming language.

The game in question, as the title suggests, is Blackjack. This was before I learnt XNA, the game development API I use today. So of course, it was a Windows Console project. For those of you unfamilliar with the card game Blackjack (also known as Pontoon), the aim of the game is for your hand to have a value of 21 or below. The game begins and all players receive two cards. On each of their turns, they can either Twist or Hold, draw a new card or stay with their hand. Once all players have taken their turns, they reveal their hands and the player with a value closest to 21, but not over it, wins the round.

A win for yours truly!

This project was originally intended to give me some practice using 'Classes'. A Class in programming can also be called a 'Type'. It is a type of variable that can be created. For example, my Blackjack program contains a class called Player, in which all of the Player's information is stored to be accessed by other parts of the program. The program was never really made full-proof, input validation was not put in place (try entering a letter into the options instead of a number, for example). Anyway, I thought I'd upload this little project for anyone to see along with some source code should anyone be interested. In future I'll show some of the more advanced things I've been working on more recently.

You can download the game here:

And the source code here:

No comments:

Post a Comment