五子棋算法(无ai)
五子棋胜利算法 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; } } } }
用户评论