我目前正在研究扑克模拟器,但无法创建一副扑克牌。
public Deck() {
int index = 0;
cards = new Card[52];
for(int cardValue = 1; cardValue <= 13; cardValue++) {
for(int suitType = 0; suitType <= 3; suitType++) {
cards[index] = new Card(cardValue, suitType);
index++;
}
}
}
Run Code Online (Sandbox Code Playgroud)
无论如何,我可以使它看起来像上面吗?
这也是我从另一个类引用的代码
/* Strings for use in toString method and also for identifying card
* images */
private final static String[] suitNames = {"s", "h", "c", "d"};
private final static String[] valueNames = {"Unused", "A", "2", "3", "4",
"5", …Run Code Online (Sandbox Code Playgroud)