该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
//创建一副扑克牌(54张)Card[] cards = new Card[54];int i = 0;for(int rank=Card.THREE;rank <= Card.DEUCE;rank++){cards[i++] = new Card(Card.DIAMOND,rank);cards[i++] = new Card(Card.HEART,rank);cards[i++] = new Card(Card.CLUB,rank);cards[i++] = new Card(Card.SPADE,rank);}cards[i++] = new Card(Card.JOKER,Card.BLACK);cards[i++] = new Card(Card.JOKER,Card.COLOR);System.out.println(Arrays.toString(cards));//洗牌,打乱Random random = new Random();for(i=cards.length-1;i>0;i--){int j = random.nextInt(i);Card card = cards[i];cards[i] = cards[j];cards[j] = card;}System.out.println(Arrays.toString(cards));//发牌Player[] players = {new Player(1,"1"),new Player(2,"2"),new Player(3,"3")};int j = 0;for(i=0;i
这是三个人随机发18张牌的,相当于斗地主的,你改下发牌的,就可以三个人一人三张了。希望对楼主有帮助