Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Deck_Class
- {
- class Deck
- {
- private Card[] _Deck = new Card[52];
- public Deck()
- {
- for (UInt16 s = 0; s <= 3; s++)
- {
- for (UInt16 v = 0; v <= 12; v++)
- {
- int index = ((v+1)*(s+1) - 1);
- _Deck[index] = new Card((int)(v + 1), (int)(s + 1));
- }
- }
- }
- public Card[] Cards
- {
- get
- {
- return _Deck;
- }
- }
- }
- class Card
- {
- public Card(FaceType Value, SuitType Suit)
- {
- this.Value = Value;
- this.Suit = Suit;
- }
- public Card(int Value, SuitType Suit)
- {
- this.Value = (FaceType)Value;
- this.Suit = Suit;
- }
- public Card(int Value, int Suit)
- {
- this.Value = (FaceType)Value;
- this.Suit = (SuitType)Suit;
- }
- public Card(FaceType Value, int Suit)
- {
- this.Value = Value;
- this.Suit = (SuitType)Suit;
- }
- private FaceType _Value;
- private SuitType _Suit;
- public enum SuitType
- {
- Clubs = 1,
- Diamonds = 2,
- Hearts = 3,
- Spades = 4
- }
- public enum FaceType
- {
- Two = 2,
- Three = 3,
- Four = 4,
- Five = 5,
- Six = 6,
- Seven = 7,
- Eight = 8,
- Nine = 9,
- Ten = 10,
- Ace = 1,
- Jack = 11,
- Queen = 12,
- King = 13
- }
- public SuitType Suit
- {
- get
- {
- return _Suit;
- }
- set
- {
- _Suit = value;
- }
- }
- public FaceType Value
- {
- get
- {
- return _Value;
- }
- set
- {
- _Value = value;
- }
- }
- public System.Drawing.Color SuitColor
- {
- get
- {
- if (this.Suit == SuitType.Diamonds || this.Suit == SuitType.Hearts)
- {
- return System.Drawing.Color.Red;
- }
- else
- {
- return System.Drawing.Color.Black;
- }
- }
- }
- public override string ToString()
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment