, , card1 card2, "". , , . .
, , :
public class Testing
{
public static void main(String[] args)
{
int Deal = 1;
ArrayList<Card> playerCards = new ArrayList<Card>();
ArrayList<Card> computerCards = new ArrayList<Card>();
Card card1;
Card card2;
for(int Hand = 0; Hand < Deal; ++Hand)
{
card1 = new Card();
card1.setSuit();
card1.setValue();
card2 = new Card();
card2.setSuit();
card2.setValue();
cardCompare(card1,card2);
playerCards.Add(card1);
computerCards.Add(card2);
}
output(card1,card2);
}
, .
. ~ 20 , , ? for, LAST, . , , for , , Thread.Sleep(), , . , , ArrayList , . , , .
By the way, I'm not sure what cardcompare () really does behind the scenes, but you probably want to make it return a bool, imagining if they were different. sort of:
bool areCardsDistinct = cardcompare(card1,card2);
Thus, you can use the result to decide whether to receive random new cards again.
source
share