-
Posted by
Matt2k35
promoted 1 year 5 months ago, posted 1 year 5 months ago
[forum]
-
| 179 views
I need help with a Uni project
c
coding
programming
I've been tasked with making a Snap card gaming using Visual Studio and XNA 4.0 and I'm just absolutely stuck on Array's. We covered them in Java using BlueJ ("Introduction to Java using BlueJ" by Barnes and Kolling, is the course material for that work).
I have currently a working menu system using a very inelegant state based system, but it works. I have everything else in place.
What I need to do is:
Build an Array to hold the 52 cards
Build a class for the cards to hold the information and methods based around the cards. This would include methods like getting the next card in a players hand ready to be displayed, shuffling the deck and then dealing the cards out to the two players.
Build an Array for each players hand so that when shuffled the cards are placed in the players hand.
That's about it, from there I think I could finish off the rest of the game using what I've written. What I need is help and guidance on how you guys might go about achieving this.
Anyway, if your university is worth its name, they should have told you a gazillion brazillion times already: flow diagrams. Either old-school pen and paper or more modern computer software. Work out the logic and the structures ... then somehow try to shape it into object-oriented code.
Anyway, if your university is worth its name, they should have told you a gazillion brazillion times already: flow diagrams. Either old-school pen and paper or more modern computer software. Work out the logic and the structures ... then somehow try to shape it into object-oriented code.
[/quote]
No, nothing wrong with OOP, as long as you don't go religious and start trying to convert "heathens" who still use procedural -- the almighty C -- programming ;)
EDIT:
Btw, can't you just do it the old-school way? Roll your own array/pointer code?
No, nothing wrong with OOP, as long as you don't go religious and start trying to convert "heathens" who still use procedural -- the almighty C -- programming
EDIT:
Btw, can't you just do it the old-school way? Roll your own array/pointer code?
[quote user=d1psh1t]
Ok, so I lurk here so much, that when this came up, I thought I might as well help as best I can.
I'm assuming you either have a struct or a class to hold the card information (color, suit, value). For example, if this is declared as:
class PlayingCard { public Color color, public String suit, public int value }To create the array you have 2 options:
PlayingCard[] cards = new PlayingCard[52];or
List cards = new List();Using the first is probably best for this situation as you only need a fixed sized array to represent the cards, and it will use less memory. The second is good if you need a dynamic array.
Following on, the class for the deck could be something like this:
class PlayingCardDeck { private PlayingCard[] cards = new PlayingCard[52]; public void Init() { } public void Shuffle() { } public void Deal(List players) { } }The Init method would populate the cards array with a full deck of cards:
for(int i = 0; i < 52; i++) { PlayingCard card = new PlayingCard(); // Setup the card cards[i] = card; }The Player class (used in the Deal method) could then hold the cards they have: e.g.
class Player { Stack cards = new Stack(); public void DealCard(PlayingCard card) { cards.Push(card); } public PlayingCard GetNextCard() { return(cards.Pop()); } }I used a stack here because when your dealing the cards, the ones that come out first usually go to the bottom of your pile and then you pull them out from the top.
I'd then put a containing class for the Game to actually keep a list of players and hold your PlayingCardDeck instance. There you can put the game controlling methods.
class SnapGameController { private List players = new List(); private PlayingCardDeck deck = new PlayingCardDeck(); }Dunno if this helps, but I tried. If it don't fuck it, but this way you have the option of having more than 2 players. Also, it would be better to move the initialisation code from in the declarations to a constructor for these classes.
[/quote]
Sorry, but I just had to ...
EDIT:
Damn biggles and his shitty CSS/WYSIWYG ...
Ok, so I lurk here so much, that when this came up, I thought I might as well help as best I can.
I'm assuming you either have a struct or a class to hold the card information (color, suit, value). For example, if this is declared as:
class PlayingCard { public Color color, public String suit, public int value }To create the array you have 2 options:
PlayingCard[] cards = new PlayingCard[52];or
List cards = new List();Using the first is probably best for this situation as you only need a fixed sized array to represent the cards, and it will use less memory. The second is good if you need a dynamic array.
Following on, the class for the deck could be something like this:
class PlayingCardDeck { private PlayingCard[] cards = new PlayingCard[52]; public void Init() { } public void Shuffle() { } public void Deal(List players) { } }The Init method would populate the cards array with a full deck of cards:
for(int i = 0; i < 52; i++) { PlayingCard card = new PlayingCard(); // Setup the card cards[i] = card; }The Player class (used in the Deal method) could then hold the cards they have: e.g.
class Player { Stack cards = new Stack(); public void DealCard(PlayingCard card) { cards.Push(card); } public PlayingCard GetNextCard() { return(cards.Pop()); } }I used a stack here because when your dealing the cards, the ones that come out first usually go to the bottom of your pile and then you pull them out from the top.
I'd then put a containing class for the Game to actually keep a list of players and hold your PlayingCardDeck instance. There you can put the game controlling methods.
class SnapGameController { private List players = new List(); private PlayingCardDeck deck = new PlayingCardDeck(); }Dunno if this helps, but I tried. If it don't fuck it, but this way you have the option of having more than 2 players. Also, it would be better to move the initialisation code from in the declarations to a constructor for these classes.
Sorry, but I just had to ...
EDIT:
Damn biggles and his shitty CSS/WYSIWYG ...
Spent enough time writing it (all of 10 minutes)... I wasn't gonna format it too!
Also, wtf is up with those L's? In class and public they've come out in capitals!
Spent enough time writing it (all of 10 minutes)... I wasn't gonna format it too!
Also, wtf is up with those L's? In class and public they've come out in capitals!
Spent enough time writing it (all of 10 minutes)... I wasn't gonna format it too!
Also, wtf is up with those L's? In class and public they've come out in capitals!
[/quote]
OMIGOSH! Big is secretly a Capitalist!!
Strange though ... I've never seen notepad capitalise anything -- unless you really used word or something ;) -- so all I can think of is the WYSIWYG doing something wonky.
Spent enough time writing it (all of 10 minutes)... I wasn't gonna format it too!
Also, wtf is up with those L's? In class and public they've come out in capitals!
OMIGOSH! Big is secretly a Capitalist!!
Strange though ... I've never seen notepad capitalise anything -- unless you really used word or something
I'd post my entire code here but it's fucking huge, I've hidden a lot away with regions to make it easier to read.
Thanks for the help, though, I'll try this out tomorrow and report back with my findings.
Oh and welcome to TAN :D
I'd post my entire code here but it's fucking huge, I've hidden a lot away with regions to make it easier to read.
Thanks for the help, though, I'll try this out tomorrow and report back with my findings.
Oh and welcome to TAN
[/quote]
Yeah ... thank the Flying Spaghetti Monster for WYMeanIWYG. I'd be in heaven if Big dropped this and implemented pure Latex! (or at least some form of decent markup)
Yeah ... thank the Flying Spaghetti Monster for WYMeanIWYG. I'd be in heaven if Big dropped this and implemented pure Latex! (or at least some form of decent markup)
[quote] public enum CardSuits
{
Clubs,
Diamonds,
Hearts,
Spades
}
/// <summary>
/// All the values of card available in a suit
/// </summary>
public enum CardValues
{
Ace,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Jack,
Queen,
King
}
/// <summary>
/// Performs texture lookup for playing deck
/// </summary>
public class CardImages
{
/// <summary>
/// Holds the textures. The dictionary maps the name of the
/// card (e.g. Three of Spades) onto the texture to be used
/// to draw it
/// </summary>
private Dictionary<string, Texture2D> cardTextures =
new Dictionary<string, Texture2D>();
/// <summary>
/// Loads all the textures for the playing card images.
/// The method assumes that the images are in a folder
/// called CardImages in the content. Each texture has
/// the name of the card, e.g. "Five of Clubs"
/// </summary>
/// <param name="content">The content manager to use to
/// load the textures</param>
public void LoadImages(ContentManager content)
{
// Work through each suit in the pack
for (int suit = 0; suit < Card.SuitValues.Length; suit++)
{
// Work through each card in a suit
for (int face = 0; face < Card.CardFaces.Length; face++)
{
// Create a card of that value and suit
Card card = new Card(Card.CardFaces[face], Card.SuitValues[suit]);
// Load the texture for that card, using the card string
Texture2D texture = content.Load<Texture2D>("CardImages/" + card.ToString());
// Store the texture in the dictionary under that name
cardTextures.Add(card.ToString(), texture);
}
}
}
/// <summary>
/// Called to get the image texture for the given playing
/// card. Will return null if the texture is not found.
/// </summary>
/// <param name="card">The card for which the image is required</param>
/// <returns>The texture for that image, or null if the
/// textures have not been set up by a call of LoadImages</returns>
public Texture2D GetTexture(Card card)
{
try
{
// Use the name of the card to locate the required texture
// A Dictionary throws an exception if the required
// card is not found
return cardTextures[card.ToString()];
}
catch
{
// Catch the dictonary exception and return
// null if there is not texture for this card
return null;
}
}
}
/// <summary>
/// Holds all the information required to represent a
/// playing card
/// </summary>
public struct Card
{
/// <summary>
/// A list of all the suits. Available for use by
/// any card based application
/// </summary>
public static CardSuits[] SuitValues = new CardSuits[]
{
CardSuits.Clubs, CardSuits.Diamonds, CardSuits.Hearts, CardSuits.Spades
};
/// <summary>
/// A list of all the card values, in order.
/// Available for any card based application.
/// </summary>
public static CardValues[] CardFaces = new CardValues[]
{
CardValues.Ace, CardValues.Two, CardValues.Three,CardValues.Four,
CardValues.Five, CardValues.Six, CardValues.Seven, CardValues.Eight,
CardValues.Nine, CardValues.Ten, CardValues.Jack, CardValues.Queen,
CardValues.King
};
/// <summary>
/// The suit of the card
/// </summary>
private CardSuits cardSuit;
/// <summary>
/// Get the suit of the card
/// </summary>
/// <returns>the suit of this card</returns>
public CardSuits GetSuit()
{
return cardSuit;
}
/// <summary>
/// The value of the card
/// </summary>
private CardValues cardValue;
/// <summary>
/// Get the value of the card
/// </summary>
/// <returns>the value of the card</returns>
public CardValues GetValue()
{
return cardValue;
}
public Card(CardValues inCardValue, CardSuits inCardSuits)
{
cardValue = inCardValue;
cardSuit = inCardSuits;
}
public override string ToString()
{
return cardValue.ToString() + " of " + cardSuit.ToString();
}
}
/// <summary>
/// Holds a hand of deck
/// </summary>
public class BlackjackHand
{
/// <summary>
/// The deck in the hand
/// </summary>
private List<Card> cards = new List<Card>();
/// <summary>
/// Remove all the deck from the hand
/// </summary>
public void Clear()
{
cards.Clear();
}
/// <summary>
/// Add a new card to the hand
/// </summary>
/// <param name="newCard">The card to be added</param>
/// <returns>true if the card was added successfully</returns>
public bool AddCard(Card newCard)
{
if (cards.Count == 8)
{
return false;
}
cards.Add(newCard);
return true;
}
/// <summary>
/// Draw the deck on the screen, spaced out as requested
/// </summary>
/// <param name="spriteBatch">the SpriteBatch to be used for the draw</param>
/// <param name="cardImages">the provider of the card images</param>
/// <param name="startRectangle">the position of the first card in the hand</param>
/// <param name="xOffset">the x distance between each successive card</param>
/// <param name="yOffset">the y distance between each successive card</param>
public void Draw(SpriteBatch spriteBatch, CardImages cardImages, Rectangle startRectangle, int xOffset, int yOffset)
{
foreach (Card card in cards)
{
spriteBatch.Draw(cardImages.GetTexture(card), startRectangle, Color.White);
startRectangle.X = startRectangle.X + xOffset;
startRectangle.Y = startRectangle.Y + yOffset;
}
}
}
/// <summary>
/// Holds a number of deck in a deck
/// </summary>
public class Deck
{
/// <summary>
/// The deck in the deck
/// </summary>
private Card[] cards;
/// <summary>
/// The number of the next card to be dealt
/// </summary>
private int nextCardNumber = 0;
/// <summary>
/// Gets the next card off the top of the
/// deck and discards it. If the end of the deck has been
/// reached the deck is shuffled.
/// </summary>
/// <returns>The next card</returns>
public Card GetNextCard()
{
Card result;
if (nextCardNumber == cards.Length)
{
Shuffle();
}
result = cards[nextCardNumber];
nextCardNumber++;
return result;
}
/// <summary>
/// Shuffles the deck
/// </summary>
public void Shuffle()
{
Random rand = new Random();
for (int i = 0; i < 100; i++)
{
int p1 = rand.Next(cards.Length);
int p2 = rand.Next(cards.Length);
Card temp = cards[p1];
cards[p1] = cards[p2];
cards[p2] = temp;
}
nextCardNumber = 0;
}
public Deck()
{
cards = new Card[52];
int cardNumber = 0;
for (int suit = 0; suit < Card.SuitValues.Length; suit++)
{
for (int face = 0; face < Card.CardFaces.Length; face++)
{
cards[cardNumber] = new Card(Card.CardFaces[face], Card.SuitValues[suit]);
cardNumber++;
}
}
Shuffle();
}
}[/quote]
Another thing I want to know is, ok, that builds an array of all the cards and puts them in there. How do I pull a specific card from the deck? I won't need to in my game but I want to know how to do this for my own understanding. For instance, I already have a rectangle in the game for the cards to go so, at the moment I can do this in order to show the card I want:
[quote]
if (Keyboard.GetState(PlayerIndex.Two).IsKeyDown(Keys.A))
{
mKeyAHasBeenPressed = true;
}
if ((Keyboard.GetState(PlayerIndex.Two).IsKeyUp(Keys.A) && mKeyAHasBeenPressed == true))
{
mKeyAHasBeenPressed = false;
mCardOneTexture = this.Content.Load<Texture2D>("Images/Cards/Two of Hearts");
}
[/quote]
Which is obviously a shit way of doing it. Would it be something like:
[quote]
if (Keyboard.GetState(PlayerIndex.Two).IsKeyDown(Keys.A))
{
mKeyAHasBeenPressed = true;
}
if ((Keyboard.GetState(PlayerIndex.Two).IsKeyUp(Keys.A) && mKeyAHasBeenPressed == true))
{
mKeyAHasBeenPressed = false;
mCardOneTexture = new Card(Card.CardFaces[Ten], Card.SuitValues[Hearts]);
}
[/quote]
?
{
Clubs,
Diamonds,
Hearts,
Spades
}
/// <summary>
/// All the values of card available in a suit
/// </summary>
public enum CardValues
{
Ace,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Jack,
Queen,
King
}
/// <summary>
/// Performs texture lookup for playing deck
/// </summary>
public class CardImages
{
/// <summary>
/// Holds the textures. The dictionary maps the name of the
/// card (e.g. Three of Spades) onto the texture to be used
/// to draw it
/// </summary>
private Dictionary<string, Texture2D> cardTextures =
new Dictionary<string, Texture2D>();
/// <summary>
/// Loads all the textures for the playing card images.
/// The method assumes that the images are in a folder
/// called CardImages in the content. Each texture has
/// the name of the card, e.g. "Five of Clubs"
/// </summary>
/// <param name="content">The content manager to use to
/// load the textures</param>
public void LoadImages(ContentManager content)
{
// Work through each suit in the pack
for (int suit = 0; suit < Card.SuitValues.Length; suit++)
{
// Work through each card in a suit
for (int face = 0; face < Card.CardFaces.Length; face++)
{
// Create a card of that value and suit
Card card = new Card(Card.CardFaces[face], Card.SuitValues[suit]);
// Load the texture for that card, using the card string
Texture2D texture = content.Load<Texture2D>("CardImages/" + card.ToString());
// Store the texture in the dictionary under that name
cardTextures.Add(card.ToString(), texture);
}
}
}
/// <summary>
/// Called to get the image texture for the given playing
/// card. Will return null if the texture is not found.
/// </summary>
/// <param name="card">The card for which the image is required</param>
/// <returns>The texture for that image, or null if the
/// textures have not been set up by a call of LoadImages</returns>
public Texture2D GetTexture(Card card)
{
try
{
// Use the name of the card to locate the required texture
// A Dictionary throws an exception if the required
// card is not found
return cardTextures[card.ToString()];
}
catch
{
// Catch the dictonary exception and return
// null if there is not texture for this card
return null;
}
}
}
/// <summary>
/// Holds all the information required to represent a
/// playing card
/// </summary>
public struct Card
{
/// <summary>
/// A list of all the suits. Available for use by
/// any card based application
/// </summary>
public static CardSuits[] SuitValues = new CardSuits[]
{
CardSuits.Clubs, CardSuits.Diamonds, CardSuits.Hearts, CardSuits.Spades
};
/// <summary>
/// A list of all the card values, in order.
/// Available for any card based application.
/// </summary>
public static CardValues[] CardFaces = new CardValues[]
{
CardValues.Ace, CardValues.Two, CardValues.Three,CardValues.Four,
CardValues.Five, CardValues.Six, CardValues.Seven, CardValues.Eight,
CardValues.Nine, CardValues.Ten, CardValues.Jack, CardValues.Queen,
CardValues.King
};
/// <summary>
/// The suit of the card
/// </summary>
private CardSuits cardSuit;
/// <summary>
/// Get the suit of the card
/// </summary>
/// <returns>the suit of this card</returns>
public CardSuits GetSuit()
{
return cardSuit;
}
/// <summary>
/// The value of the card
/// </summary>
private CardValues cardValue;
/// <summary>
/// Get the value of the card
/// </summary>
/// <returns>the value of the card</returns>
public CardValues GetValue()
{
return cardValue;
}
public Card(CardValues inCardValue, CardSuits inCardSuits)
{
cardValue = inCardValue;
cardSuit = inCardSuits;
}
public override string ToString()
{
return cardValue.ToString() + " of " + cardSuit.ToString();
}
}
/// <summary>
/// Holds a hand of deck
/// </summary>
public class BlackjackHand
{
/// <summary>
/// The deck in the hand
/// </summary>
private List<Card> cards = new List<Card>();
/// <summary>
/// Remove all the deck from the hand
/// </summary>
public void Clear()
{
cards.Clear();
}
/// <summary>
/// Add a new card to the hand
/// </summary>
/// <param name="newCard">The card to be added</param>
/// <returns>true if the card was added successfully</returns>
public bool AddCard(Card newCard)
{
if (cards.Count == 8)
{
return false;
}
cards.Add(newCard);
return true;
}
/// <summary>
/// Draw the deck on the screen, spaced out as requested
/// </summary>
/// <param name="spriteBatch">the SpriteBatch to be used for the draw</param>
/// <param name="cardImages">the provider of the card images</param>
/// <param name="startRectangle">the position of the first card in the hand</param>
/// <param name="xOffset">the x distance between each successive card</param>
/// <param name="yOffset">the y distance between each successive card</param>
public void Draw(SpriteBatch spriteBatch, CardImages cardImages, Rectangle startRectangle, int xOffset, int yOffset)
{
foreach (Card card in cards)
{
spriteBatch.Draw(cardImages.GetTexture(card), startRectangle, Color.White);
startRectangle.X = startRectangle.X + xOffset;
startRectangle.Y = startRectangle.Y + yOffset;
}
}
}
/// <summary>
/// Holds a number of deck in a deck
/// </summary>
public class Deck
{
/// <summary>
/// The deck in the deck
/// </summary>
private Card[] cards;
/// <summary>
/// The number of the next card to be dealt
/// </summary>
private int nextCardNumber = 0;
/// <summary>
/// Gets the next card off the top of the
/// deck and discards it. If the end of the deck has been
/// reached the deck is shuffled.
/// </summary>
/// <returns>The next card</returns>
public Card GetNextCard()
{
Card result;
if (nextCardNumber == cards.Length)
{
Shuffle();
}
result = cards[nextCardNumber];
nextCardNumber++;
return result;
}
/// <summary>
/// Shuffles the deck
/// </summary>
public void Shuffle()
{
Random rand = new Random();
for (int i = 0; i < 100; i++)
{
int p1 = rand.Next(cards.Length);
int p2 = rand.Next(cards.Length);
Card temp = cards[p1];
cards[p1] = cards[p2];
cards[p2] = temp;
}
nextCardNumber = 0;
}
public Deck()
{
cards = new Card[52];
int cardNumber = 0;
for (int suit = 0; suit < Card.SuitValues.Length; suit++)
{
for (int face = 0; face < Card.CardFaces.Length; face++)
{
cards[cardNumber] = new Card(Card.CardFaces[face], Card.SuitValues[suit]);
cardNumber++;
}
}
Shuffle();
}
}
Another thing I want to know is, ok, that builds an array of all the cards and puts them in there. How do I pull a specific card from the deck? I won't need to in my game but I want to know how to do this for my own understanding. For instance, I already have a rectangle in the game for the cards to go so, at the moment I can do this in order to show the card I want:
if (Keyboard.GetState(PlayerIndex.Two).IsKeyDown(Keys.A))
{
mKeyAHasBeenPressed = true;
}
if ((Keyboard.GetState(PlayerIndex.Two).IsKeyUp(Keys.A) && mKeyAHasBeenPressed == true))
{
mKeyAHasBeenPressed = false;
mCardOneTexture = this.Content.Load<Texture2D>("Images/Cards/Two of Hearts");
}
Which is obviously a shit way of doing it. Would it be something like:
if (Keyboard.GetState(PlayerIndex.Two).IsKeyDown(Keys.A))
{
mKeyAHasBeenPressed = true;
}
if ((Keyboard.GetState(PlayerIndex.Two).IsKeyUp(Keys.A) && mKeyAHasBeenPressed == true))
{
mKeyAHasBeenPressed = false;
mCardOneTexture = new Card(Card.CardFaces[Ten], Card.SuitValues[Hearts]);
}
?
I'd post my entire code here but it's fucking huge, I've hidden a lot away with regions to make it easier to read.
Thanks for the help, though, I'll try this out tomorrow and report back with my findings.
Oh and welcome to TAN :D
[/quote]
Thanks. Just watch out with Tuoni's reformatted code, It's missing the angled brackets on the generic types (List and Queue), so it's changed List<Player> to List and the same on the queue,
I'd post my entire code here but it's fucking huge, I've hidden a lot away with regions to make it easier to read.
Thanks for the help, though, I'll try this out tomorrow and report back with my findings.
Oh and welcome to TAN
Thanks. Just watch out with Tuoni's reformatted code, It's missing the angled brackets on the generic types (List and Queue), so it's changed List<Player> to List and the same on the queue,
Another thing I want to know is, ok, that builds an array of all the cards and puts them in there. How do I pull a specific card from the deck? I won't need to in my game but I want to know how to do this for my own understanding. For instance, I already have a rectangle in the game for the cards to go so, at the moment I can do this in order to show the card I want:
[quote user=] }[/quote]
Which is obviously a shit way of doing it. Would it be something like:
[quote user=] }[/quote]
?
[/quote]
Looking at what your trying to do, it might be easier to preload all your card images when LoadContent is called in their own struct and store them in an array:
struct CardTexture
{
public CardSuits suit;
public CardValues value;
public Texture2D texture;
};
CardTexture[] cardTextures = new CardTexture[52];
When you need to pull a card out of the deck to display, you can iterate through them testing for the card you want. Depending on how often this is done it may have a performance impact, but if your only doing it every now and then it won't cause any problems.
Thinking about it, the only other way to get a card out faster would be to implement a hash table (you can use the generic Dictionary type for this). Only thing with that is that in the card class you'll have to override Equals and GetHashCode. The Equals will check that the card is the one your looking for. The GetHashCode is used to ensure the keys are "spread" nicely so that when the Dictionary tries to find it, it can use more of a binary search than iterating through each one.
Personally, I'd just go for iterating over them, as it's much easier to code, and won't cause you much of a performance hit compared with the amount of head scratching you might find yourself doing trying to implement GetHashCode correctly.
Another thing I want to know is, ok, that builds an array of all the cards and puts them in there. How do I pull a specific card from the deck? I won't need to in my game but I want to know how to do this for my own understanding. For instance, I already have a rectangle in the game for the cards to go so, at the moment I can do this in order to show the card I want:
Which is obviously a shit way of doing it. Would it be something like:
?
Looking at what your trying to do, it might be easier to preload all your card images when LoadContent is called in their own struct and store them in an array:
struct CardTexture
{
public CardSuits suit;
public CardValues value;
public Texture2D texture;
};
CardTexture[] cardTextures = new CardTexture[52];
When you need to pull a card out of the deck to display, you can iterate through them testing for the card you want. Depending on how often this is done it may have a performance impact, but if your only doing it every now and then it won't cause any problems.
Thinking about it, the only other way to get a card out faster would be to implement a hash table (you can use the generic Dictionary type for this). Only thing with that is that in the card class you'll have to override Equals and GetHashCode. The Equals will check that the card is the one your looking for. The GetHashCode is used to ensure the keys are "spread" nicely so that when the Dictionary tries to find it, it can use more of a binary search than iterating through each one.
Personally, I'd just go for iterating over them, as it's much easier to code, and won't cause you much of a performance hit compared with the amount of head scratching you might find yourself doing trying to implement GetHashCode correctly.
[/quote]
No problem. I had signed up about 3 months ago when I was drunk to comment on a post about Sarah Palin coz she was shitting on the UK and it wound me up a fuck load. Stupid bitch.
No problem. I had signed up about 3 months ago when I was drunk to comment on a post about Sarah Palin coz she was shitting on the UK and it wound me up a fuck load. Stupid bitch.
finally, fuck you tuoni, i aint make tinymce. i just use it
finally, fuck you tuoni, i aint make tinymce. i just use it