I'm not sure if I asked the right question but that's as close as I could think of. Anyway, I'm trying to make a simplified version of Solitaire known as Elevens. Everything seemed to be fine at compilation stage, but when it ran through, it didn't work as intended. Below are the methods of my Deck
and DeckTester
classes that pertain to the question:
Note: I left out the headers and stuff
Deck
class constructor and one of the methods:
public Deck(String[] suits, String[] ranks, int[] values){
ArrayList<Card> cardslist = new ArrayList<Card>();
for(String suit: suits){
for(String rank: ranks){
for(int value: values){
cardslist.add(new Card(suit, rank, value));
}
}
}
size=cardslist.size();
cards=cardslist;
}
public List<Card> getDeck(){
return cards;
}
DeckTester
main method:
public static void main(String[] args){
String[] suitsA={"Clubs", "Diamonds", "Hearts", "Spades"};
String[] ranksA={"Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
int[] valuesA={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
String[] suitsB={"Lions", "Giraffes", "Wolves"};
String[] ranksB={"One", "Two", "Three"};
int[] valuesB={1, 2, 3};
Deck a = new Deck(suitsA, ranksA, valuesA);
Deck b = new Deck(suitsB, ranksB, valuesB);
System.out.println(a.getDeck());
System.out.println(b.getDeck());
}
This is producing a result of an array like {Ace of Clubs (point value: 1)...Ace of Clubs (point value: 13), Two of Clubs (point value: 1), etc}
I would like it to produce like a standard deck of cards.