五子棋算法(无ai)

时间:2021-08-26 04:26:03
【文件属性】:

文件名称:五子棋算法(无ai)

文件大小:5KB

文件格式:JAVA

更新时间:2021-08-26 04:26:03

五子棋

五子棋胜利算法 public class goBang { //棋盘长度 private int length = 20; //创建棋盘 private String[][] goBang = new String[length][length]; //棋盘下标 private String[] nums = new String[] {"⒈","⒉","⒊","⒋","⒌","⒍","⒎","⒏","⒐","⒑","⒒","⒓","⒔","⒕","⒖","⒗","⒘","⒙","⒚","⒛"}; //棋盘素材 private String add = "╋"; private String black = "●"; private String white = "○"; { init(); print(); } //初始化数据 private void init() { for (int i = 0; i < goBang.length; i++) { for (int j = 0; j < goBang[i].length; j++) { if (j==length-1) { goBang[i][j] = nums[i]; }else if (i==length-1) { goBang[i][j] = nums[j]; }else { goBang[i][j] = add; } } } }


网友评论