到目前为止,我有以下代码:
class Card{
private static String[] pairArray{"A,A","K,K","Q,Q","J,J","10,10",
"9,9","8,8","7,7","6,6","5,5","4,4","3,3","2,2"};
public static void generateRandom(){
int minimum = 0;
int maximum = 13;
int randomNum = minimum + (int)(Math.random()* maximum);
System.out.print("Player 1, You have been dealt a pair of: ");
System.out.println(pairArray[randomNum]);
}
public static void main(String[] args) {
generateRandom();
}
}
它将数组中的一个元素随机分配给玩家 1。
我需要读取用户输入的他想和多少玩家一起玩的信息,然后生成 4 次,每个玩家得到一组不同的卡片。我想我需要使用扫描仪功能,但我不确定将其包含在此代码中的哪个位置。