SHARE
TWEET

Untitled

a guest Mar 18th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     for(int i=0; i<(size); i++){
  2.                     for(int j=0; j<(size); j++){
  3.                         int actual = size*i+j;
  4.                         if((i == (size-1)) && (j == 0)){ // LU(0), U(1), RU(2), L(3), R(4), LD(5), D(6), RD(7)
  5.                             System.out.printf("[7,0]\n");
  6.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.L.ordinal()] = this.boardArray[i][j-1];
  7.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.U.ordinal()] = this.boardArray[i+1][j];
  8.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.LU.ordinal()] = this.boardArray[i+1][j-1];
  9.                         }else if( (i == (size-1)) && (j == (size-1)) ){
  10.                             System.out.printf("[7,7]\n");
  11.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.L.ordinal()] = this.boardArray[i][j-1];
  12.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.LD.ordinal()] = this.boardArray[i-1][j-1];
  13.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.D.ordinal()] = this.boardArray[i-1][j];
  14.                         }else if( actual == 0 ){  
  15.                             System.out.printf("[0,0]\n");
  16.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.U.ordinal()] = this.boardArray[i][j+1];
  17.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.RU.ordinal()] = this.boardArray[i+1][j+1];
  18.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.R.ordinal()] = this.boardArray[i+1][j];
  19.                         }else if( actual == (size-1) ){
  20.                             System.out.printf("[0,7]\n");
  21.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.RD.ordinal()] = this.boardArray[i+1][j-1];
  22.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.D.ordinal()] = this.boardArray[i][j-1];
  23.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.R.ordinal()] = this.boardArray[i+1][j];
  24.                         }else if(isBetween((size*(size-1)+1), ((size*size)-1), actual)){ //pravý sloupec 0,1,3,5,6
  25.                             System.out.printf("pravy slupec\n");
  26.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.LU.ordinal()] = this.boardArray[i+1][j-1];
  27.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.U.ordinal()] = this.boardArray[i+1][j];
  28.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.L.ordinal()] = this.boardArray[i][j-1];
  29.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.LD.ordinal()] = this.boardArray[i-1][j-1];
  30.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.D.ordinal()] = this.boardArray[i-1][j];
  31.                             //System.out.printf("Tu %d%d\n", this.boardArray[i][j].objColumn, this.boardArray[i][j].objRow);
  32.                             //System.out.printf("Tu %d%d\n", this.boardArray[i][j].theNeighbourFields[Field.Direction.L.ordinal()].objColumn, this.boardArray[i][j].theNeighbourFields[Field.Direction.L.ordinal()].objRow);
  33.                         }else if(isBetween(1, (size-2), actual)){ // levý sloupec
  34.                             System.out.printf("levy sloupec\n");
  35.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.U.ordinal()] = this.boardArray[i+1][j];
  36.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.RU.ordinal()] = this.boardArray[i+1][j+1];
  37.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.R.ordinal()] = this.boardArray[i][j+1];
  38.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.D.ordinal()] = this.boardArray[i-1][j];
  39.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.RD.ordinal()] = this.boardArray[i-1][j+1];
  40.                         }else if( (actual % size) == (size-1) ){ // spodni řádek 1-6
  41.                             System.out.printf("spodni radek\n");
  42.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.L.ordinal()] = this.boardArray[i][j-1];
  43.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.R.ordinal()] = this.boardArray[i][j+1];
  44.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.LD.ordinal()] = this.boardArray[i-1][j-1];
  45.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.D.ordinal()] = this.boardArray[i-1][j];
  46.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.RD.ordinal()] = this.boardArray[i-1][j+1];
  47.                         }else if( (actual%size) == 0 ){ // horni řádek 57-63
  48.                             System.out.printf("horni radek\n");
  49.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.LU.ordinal()] = this.boardArray[i+1][j-1];
  50.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.U.ordinal()] = this.boardArray[i+1][j];
  51.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.RU.ordinal()] = this.boardArray[i+1][j+1];
  52.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.L.ordinal()] = this.boardArray[i][j-1];
  53.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.R.ordinal()] = this.boardArray[i][j+1];
  54.                         }else{ // zbytek, pole co nejsou na kraji
  55.                             System.out.printf("else\n");
  56.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.LU.ordinal()] = this.boardArray[i+1][j-1];
  57.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.U.ordinal()] = this.boardArray[i+1][j];
  58.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.RU.ordinal()] = this.boardArray[i+1][j+1];
  59.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.L.ordinal()] = this.boardArray[i][j-1];
  60.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.R.ordinal()] = this.boardArray[i][j+1];
  61.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.LD.ordinal()] = this.boardArray[i-1][j-1];
  62.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.D.ordinal()] = this.boardArray[i-1][j];
  63.                             this.boardArray[i][j].theNeighbourFields[Field.Direction.RD.ordinal()] = this.boardArray[i-1][j+1];
  64.                                 //System.out.printf("\nTu %d\n", this.boardArray[i][j].objColumn);
  65.                                 //System.out.printf("Tu %d\n", this.boardArray[i][j].objRow);
  66.                                 System.out.printf("Tu %d\n", this.boardArray[i][j].theNeighbourFields[Field.Direction.LD.ordinal()].objColumn);
  67.                                 System.out.printf("Tu %d\n", this.boardArray[i][j].theNeighbourFields[Field.Direction.LD.ordinal()].objRow);
  68.                         }
  69.                     }
  70.                 }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top