packageReversi_JCoder;import java.awt.*;importjava.awt.Button;importjava.awt.Container;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;import javax.swing.*;public class Reversi extendsJFrame{static JButton mmp[][] = new JButton[8][8];static int chess[][] = new int[8][8];static int dir[][] = { {0,1},{1,0},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};static int color = 2;static int check(int x,int y,intcolor){if(chess[x][y] != 1 && chess[x][y] != 2){for(int i = 0;i < 8;i ++){int tx = x + dir[i][0];int ty = y + dir[i][1];if(tx >= 0 && tx < 8 && ty >= 0 && ty < 8 && chess[tx][ty] > 0 && chess[tx][ty] !=color){return 1;
}
}
}return 0;
}static voidPrint(){for(int i = 0;i < 8;i ++){for(int j = 0;j < 8;j ++){if(chess[i][j] == 1){mmp[i][j].setBackground(Color.WHITE);}else if(chess[i][j] == 2){mmp[i][j].setBackground(Color.BLACK);}
}
}return;
}static inthasZero(String p) {if(p.length() == 0) {return 0;}return p.indexOf("0");
}static int change(int x,int y,intcolor){int isChange = 0;int diff = 3 -color;
String p= "";int f = 0;for(int i = x - 1;i >= 0;i --) {//west
if(chess[i][y] == color) {f = 1;break;}
p+=String.valueOf(chess[i][y]);