Java斗地主--index1 (0801)
创始人
2024-11-11 13:39:24
0

今天遇到一个很有意思的游戏–斗地主,那么下面就开始实现斗地主啦!!!

package Demo_YY;  public class PockerIndex {   public static void main(String[] args) {     start();   }    public static void start(){     String pocker[] = new String[54];     String colors[] = {"♠","♣","♥","♦"};     String nums[] = {"3","4","5","6","7","8","9","10","J","Q","K","A","2"};      int index = 0;     for (int i = 0; i < nums.length; i++){       for (int j = 0; j < colors.length; j++){         pocker[index++] = colors[j] + nums[i];       }     }  //    大小王🃏🂿     pocker[index++] ="\uD83C\uDCCF";     pocker[index] ="\uD83C\uDCBF"; //    看牌     for (int i = 0; i < pocker.length; i++){       System.out.print(pocker[i]+"\t");       if((i+1) % 4 == 0 )       {         System.out.println();       }     }    } } 

请添加图片描述

  int index = 0;     for (int i = 0; i < colors.length; i++){       for (int j = 0; j < nums.length; j++){         pocker[index++] = colors[i] + nums[j];       }     } 

修改了这里之后发现什么了呢?就是顺序不一样而已啦!
请添加图片描述
这里只是存储了54张牌,下面我们开始洗牌啦!

package Demo_YY;  public class PockerIndex {  public static void main(String[] args) {    start();  }   public static void start(){    String pocker[] = new String[54];    String colors[] = {"♠","♣","♥","♦"};    String nums[] = {"3","4","5","6","7","8","9","10","J","Q","K","A","2"};     int index = 0;    for (int i = 0; i < nums.length; i++){      for (int j = 0; j < colors.length; j++){        pocker[index++] = colors[j] + nums[i];      }    }  //    大小王🃏🂿    pocker[index++] ="\uD83C\uDCCF";    pocker[index] ="\uD83C\uDCBF";    System.out.println("\t\t\t看牌"); //    看牌    for (int i = 0; i < pocker.length; i++){      System.out.print(pocker[i]+"\t");      if((i+1) % 8 == 0 )      {        System.out.println();      }    }    System.out.println();    System.out.println(); //    洗牌    for(int i = 0; i < pocker.length; i++){      int index1 = (int)(Math.random()*pocker.length);      int index2 = (int)(Math.random()*pocker.length);      String temp = pocker[index1];      pocker[index1] = pocker[index2];      pocker[index2] = temp;    }    System.out.println("\t\t\t洗牌后\t\t");    for (int i = 0; i < pocker.length; i++){      System.out.print(pocker[i]+"\t");      if((i+1) % 8 == 0 )      {        System.out.println();      }    }    }   }  

请添加图片描述
完结,moyu_ing

相关内容

热门资讯

外挂步骤!拱趴大菠萝挂哪里,德... 外挂步骤!拱趴大菠萝挂哪里,德扑之心免费透视-果然真的是有辅助方法(哔哩哔哩)1、下载好拱趴大菠萝挂...
1.9分钟了解!有没有人wep... 1.9分钟了解!有没有人wepoker,老友麻将辅助器,切实是真的有辅助辅助(发现有挂)1、这是跨平...
刚刚!wepoker辅助透视软... 刚刚!wepoker辅助透视软件(透视)一直是真的辅助平台(有挂方法)-哔哩哔哩1、该软件可以轻松地...
外挂教材!德州来玩辅助器,哈糖... 外挂教材!德州来玩辅助器,哈糖大菠萝可以开挂吗-竟然是有辅助脚本(哔哩哔哩)1)哈糖大菠萝可以开挂吗...
带你了解!wepoker透视苹... 带你了解!wepoker透视苹果系统,微乐麻将脚本透视,切实存在有辅助脚本(有挂方式)微乐麻将脚本透...
针对!wepoker软件安装包... 针对!wepoker软件安装包(透视)都是是有辅助修改器(有挂规律)-哔哩哔哩1、玩家可以在wepo...
外挂指引!werplan有挂吗... 外挂指引!werplan有挂吗,pokemomo辅助工具-一贯存在有辅助技巧(哔哩哔哩)1、poke...
解密关于!hhpoker怎么防... 解密关于!hhpoker怎么防作必弊,多乐游戏破解版,一直是有辅助开挂(证实有挂)1、下载好多乐游戏...
截至目前!wepoker有没有... 截至目前!wepoker有没有辅助(透视)其实真的有辅助工具(有挂方略)-哔哩哔哩1、在wepoke...
外挂大纲!拱趴大菠萝辅助神器,... 外挂大纲!拱趴大菠萝辅助神器,德州透视竞技联盟-好像有辅助神器(哔哩哔哩)1、下载好拱趴大菠萝辅助神...