public static void main(String args[]) throws Exception { Gobang gd = new Gobang(); gd.initBoard(); gd.printBoard(); System.out.println("请输入你下棋的坐标,以x,y格式"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputStr = null; while ((inputStr = br.readLine()) != null) { String[] posStrarr = inputStr.split(","); int xPos = Integer.parseInt(posStrarr[0]); int yPos = Integer.parseInt(posStrarr[1]); gd.board[xPos - 1][yPos - 1] = "*"; gd.printBoard(); System.out.println("请输入你下棋的坐标,以x,y格式"); } }
public static void main(String[] args) throws Exception { Gobang gb = new Gobang(); gb.init(); }