Guest User

Untitled

a guest
Nov 25th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Deck_Class
  7. {
  8.     class Deck
  9.     {
  10.         private Card[] _Deck = new Card[52];
  11.        
  12.         public Deck()
  13.         {
  14.             for (UInt16 s = 0; s <= 3; s++)
  15.             {
  16.                 for (UInt16 v = 0; v <= 12; v++)
  17.                 {
  18.                     int index = ((v+1)*(s+1) - 1);
  19.                     _Deck[index] = new Card((int)(v + 1), (int)(s + 1));
  20.                 }
  21.             }
  22.         }
  23.  
  24.         public Card[] Cards
  25.         {
  26.             get
  27.             {
  28.                 return _Deck;
  29.             }
  30.         }
  31.  
  32.     }
  33.  
  34.     class Card
  35.     {
  36.         public Card(FaceType Value, SuitType Suit)
  37.         {
  38.             this.Value = Value;
  39.             this.Suit = Suit;
  40.         }
  41.         public Card(int Value, SuitType Suit)
  42.         {
  43.             this.Value = (FaceType)Value;
  44.             this.Suit = Suit;
  45.         }
  46.         public Card(int Value, int Suit)
  47.         {
  48.             this.Value = (FaceType)Value;
  49.             this.Suit = (SuitType)Suit;
  50.         }
  51.         public Card(FaceType Value, int Suit)
  52.         {
  53.             this.Value = Value;
  54.             this.Suit = (SuitType)Suit;
  55.         }
  56.  
  57.  
  58.  
  59.         private FaceType _Value;
  60.         private SuitType _Suit;
  61.  
  62.         public enum SuitType
  63.         {
  64.             Clubs = 1,
  65.             Diamonds = 2,
  66.             Hearts = 3,
  67.             Spades = 4
  68.         }
  69.         public enum FaceType
  70.         {
  71.             Two = 2,
  72.             Three = 3,
  73.             Four = 4,
  74.             Five = 5,
  75.             Six = 6,
  76.             Seven = 7,
  77.             Eight = 8,
  78.             Nine = 9,
  79.             Ten = 10,
  80.  
  81.             Ace = 1,
  82.             Jack = 11,
  83.             Queen = 12,
  84.             King = 13
  85.         }
  86.  
  87.         public SuitType Suit
  88.         {
  89.             get
  90.             {
  91.                 return _Suit;
  92.             }
  93.             set
  94.             {
  95.                 _Suit = value;
  96.             }
  97.         }
  98.         public FaceType Value
  99.         {
  100.             get
  101.             {
  102.                 return _Value;
  103.             }
  104.             set
  105.             {
  106.                 _Value = value;
  107.             }
  108.         }
  109.         public System.Drawing.Color SuitColor
  110.         {
  111.             get
  112.             {
  113.                 if (this.Suit == SuitType.Diamonds || this.Suit == SuitType.Hearts)
  114.                 {
  115.                     return System.Drawing.Color.Red;
  116.                 }
  117.                 else
  118.                 {
  119.                     return System.Drawing.Color.Black;
  120.                 }
  121.             }
  122.         }
  123.  
  124.         public override string ToString()
  125.         {
  126.            
  127.         }
  128.     }
  129. }
Add Comment
Please, Sign In to add comment