小编Joh*_*rry的帖子

创建卡片组?

我目前正在研究扑克模拟器,但无法创建一副扑克牌。

我当前的代码创建甲板

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)

java poker constructor

-1
推荐指数
1
解决办法
2019
查看次数

标签 统计

constructor ×1

java ×1

poker ×1