How do I perform the perfectShuffle operation to my "deck" array?
I do not know how to import the "deck" array into my perfectShuffle method/class (idk wtf is the difference)
This Does NOT compile because my perfectShuffle cant find ''deck''
I'm pretty sure you're gonna look at my code and be like 'wtf do u even know what you're doing?' well no I dont know what i'm doing but ive gotten super far with not knowing what im doing by creating a deck array of every card in a deck of cards.
Im struggling to find the flow from class/method/object/instance watever and how they interact.
Any help or points to resources is greatly appreciated.
public String[] Deck(){
String[] deck = new String[52];
//Populate Deck 2-10
for (int i=0; i<52; i++){
if (i<9){
for (int j=2; j<=10; j++){
deck[i]=(j+" of Clubs");
i++;
}
}
if (12<i&&i<22){
for (int j=2; j<=10; j++){
deck[i]=(j+" of Diamonds");
i++;
}
}
if (25<i&&i<35){
for (int j=2; j<=10; j++){
deck[i]=(j+" of Hearts");
i++;
}
}
if (38<i&&i<48){
for (int j=2; j<=10; j++){
deck[i]=(j+" of Spades");
i++;
}
}
else {
deck[9]=("Jack of Clubs");
deck[10]=("Queen of Clubs");
deck[11]=("King of Clubs");
deck[12]=("Ace of Clubs");
deck[22]=("Jack of Diamonds");
deck[23]=("Queen of Diamonds");
deck[24]=("King of Diamonds");
deck[25]=("Ace of Diamonds");
deck[35]=("Jack of Hearts");
deck[36]=("Queen of Hearts");
deck[37]=("King of Hearts");
deck[38]=("Ace of Hearts");
deck[48]=("Jack of Spades");
deck[49]=("Queen of Spades");
deck[50]=("King of Spades");
deck[51]=("Ace of Spades");
}
}
}
private void perfectShuffle(){
Deck();
for (int i=0; i<27; i++){
deck[i]=deck[i+26];
}
for (int i=0; i<52; i++){
System.out.println(deck[i]);
}
}