|
using System;
namespace BlackJack
{
/// <summary>
/// Summary description for Deck.
/// </summary>
public class Deck
{
private const int numberCardsPerDeck = 52;
private Card[] cards;
public Deck()
{
for( int i=0; i < numberCardsPerDeck; i++ )
{
cards[i].cardValue = i;
switch( i )
{
case 0:
cards[i].face = "A diamonds";
break;
case 1:
cards[i].face = "A clubs";
break;
case 2:
cards[i].face = "A hearts";
break;
case 3:
cards[i].face = "A spades";
break;
case 4:
cards[i].face = "2 diamonds";
break;
case 5:
cards[i].face = "2 clubs";
break;
case 6:
cards[i].face = "2 hearts";
break;
case 7:
cards[i].face = "2 spades";
break;
case 8:
cards[i].face = "3 diamonds";
break;
case 9:
cards[i].face = "3 clubs";
break;
case 10:
cards[i].face = "3 hearts";
break;
case 11:
cards[i].face = "3 spades";
break;
case 12:
cards[i].face = "4 diamonds";
break;
case 13:
cards[i].face = "4 clubs";
break;
case 14:
cards[i].face = "4 hearts";
break;
case 15:
cards[i].face = "4 spades";
break;
}
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
I'm a software engineer and consultant working in San Diego, California. I began using .NET during the early alpha releases since I worked for a Microsoft subsidiary then, and now I've focused my career on .NET technologies.
There are a lot of .NET sites out there now, but The Code Project is still top of the heap.