Not sure if my title made much sense, here is a better explanation! I have a card shuffler that shuffles and deals out cards. One of the exercises asked me to display cards for a game of euchre so only display 9s 10s jacks queens kings and aces. (displays them in a listbox)
I was wondering how this:
if (cardCount % 6 == 0 && cardCount > 0)
{
lstDeck.Items.Add(buff);
buff = " ";
}
Works fine, I get four lines of six cards but using this: if(cardCount == 6) only displays the first six cards in a line.
cardCount is just a tally of acceptable cards for euchre.
Thanks!
Some more code:
deckSize = myDeck.DeckSize;
cardIndex = 1;
cardCount = 0;
buff = "";
while (cardIndex < deckSize + 1)
{
card = myDeck.GetCardIndex();
if(card % 13 < 9 && card % 13 != 0 && card % 13 != 1)
{
myDeck.Incrementer(); // increment card
cardIndex++;
continue;
}
temp = myDeck.getOneCard(cardIndex); // get card to display and increment card
buff += temp + " ";
cardIndex++;
cardCount++;
if (cardCount % 6 == 0 && cardCount > 0)
{
lstDeck.Items.Add(buff);
buff = " ";
}
}
lstDeck.Items.Add("");
}
This post has been edited by insanepenguin: 24 August 2011 - 08:27 AM

New Topic/Question
Reply




MultiQuote






|