Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- int[][] chessTable = new int[20][20];
- boolean chetnRow = false;
- int accCol =3;
- for (int i =0; i < 20; i++) {
- int ONE_NUM;
- int TWO_NUM;
- if (accCol !=0){
- accCol--;
- ONE_NUM = 1;
- TWO_NUM = 0;
- }
- else {
- accCol =3;
- chetnRow =!chetnRow;
- ONE_NUM = 0;
- TWO_NUM = 1;
- //System.out.println("nechetn chisl");
- }
- int acc = 4;
- //boolean chetnRow = false;
- for (int j = 0; j < 20; j++){
- if (acc != 0) {
- chessTable[i][j] = chetnRow ? ONE_NUM : TWO_NUM;
- acc--;
- }
- else {
- acc = 3;
- chetnRow = !chetnRow;
- chessTable[i][j] = chetnRow ? ONE_NUM : TWO_NUM;
- }
- System.out.print(" " + chessTable[i][j]);
- }
- System.out.println("");
- }
- //System.out.print(chessTable[i][j]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement