纯用list集合实现斗地主发牌效果
程序员文章站
2022-03-30 23:03:57
package com.wh;import java.util.*;public class Landlord { public static void main(String[] args) { //存储牌的信息 编号及花色的组合 List list1=new ArrayList<>(); //存放编号54个 List list2=new ArrayLis...
package com.wh;
import java.util.*;
public class Landlord {
public static void main(String[] args) {
//存储牌的信息 编号及花色的组合
List<String> list1=new ArrayList<>();
//存放编号54个
List<Integer> list2=new ArrayList<>();
//4种花色
String[] color={"♥","♠","♦","♣"};
//13种数字
String[] numbers={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
//记录编号
int index=0;
//将花色和数字组合
for(String co:color){
for(String num:numbers){
list1.add(co+num);
list2.add(index);
index++;
}
}
list2.add(52);
list2.add(53);
list1.add("大
下一篇: 我就喝了点汤