Forum guidelines
AuthorQuestion
Basic C# blackjack game
Posted By Jared Tracy on 15 Sep 2008
Hi, I'm new to C#...very new and am having tons of problems with my second project...we are to make a simple c# blackjack game and the rules are this:
  • Dealer draws two cards
  • User draws two cards
  • User can choose to hit (draw another card) or stay
  • If user chooses to hit, then the user draws another card
  • The dealer will draw another card if his point total is < 17
  • The winner is the closest to 21 points without going over
  • If both the user and dealer go over 21 points, there is no winner
  • If the user and dealer tie (for 21 points or less), the user wins
It is supposed to look like this:
Dealer has:
             ace of spades
             2 of hearts
Dealer Total:
You have:
             ......
             .......
Your Total:

Enter (h)it or (s)tay:
You Draw:
Dealer Draws:

Dealer Total
Your total

winner

can anyone show me how to do this or give some help PLEASE!!!??


AuthorReply
Re: Basic C# blackjack game
Posted By Mahesh Chand on 16 Sep 2008  

Here is an article and code on BlackJack in C#:

So as a learning experience, I decided to try writing a Blackjack game.

C# Corner
Re: Basic C# blackjack game
Posted By Konstantin Tarkus on 27 Dec 2013  
You may want to check out this Blackjack Sample Project (C#) for Visual Studio:

https://github.com/koistya/Blackjack

Web and cloud solutions architect, programmer, hacker, entrepreneur
Re: Basic C# blackjack game
Posted By Vulpes on 27 Dec 2013  
Microsoft also have a free 'card game starter kit' which takes the form of a Blackjack game:

http://visualstudiogallery.msdn.microsoft.com/049d2fe9-f845-48ae-a34d-acbded9f7e5a



Ken H
  • 1
  • 0
Re: Basic C# blackjack game
Posted By Ken H on 04 Jan 2014  
hello Vulpes,
     Can you explain the following bold What does this mean(What does it do)?
 private BlackJackGame game = new BlackJackGame(Properties.Settings.Default.InitBalance);

Thank for you.


Re: Basic C# blackjack game
Posted By Vulpes on 05 Jan 2014  
Ken,

The Properties.Settings.Default object exposes all the default settings for the project. In this case the value of a setting called 'InitBalance' is being passed to the BlackjackGame constructor when creating a new game.

I don't have the code for this game to hand but I'd imagine that InitBalance represents the player's initial balance (i.e stake) at the start of the game.

 

Ken H
  • 0
  • 0
Re: Basic C# blackjack game
Posted By Ken H on 06 Jan 2014  
Thank for you ,Vulpes


SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.