扑克牌少一张JAVA,纸牌游戏,随机输出三张扑克牌

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

//创建一副扑克牌(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张牌的,相当于斗地主的,你改下发牌的,就可以三个人一人三张了。希望对楼主有帮助

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值