Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. or (int i = 1; i < size+1; i++) {
  2. for(int j = 1; j < size+1; j++) {
  3. if (i-1 > 0) {
  4. this.board[j][i].list_of_neighbors[Field.Direction.D.ordinal()] = this.board[j][i-1];
  5. }
  6. if (j-1 > 0) {
  7. this.board[j][i].list_of_neighbors[Field.Direction.L.ordinal()] = this.board[j-1][i];
  8. }
  9. if (i-1 > 0 && j-1 > 0) {
  10. this.board[j][i].list_of_neighbors[Field.Direction.LD.ordinal()] = this.board[j-1][i-1];
  11. }
  12. if (i+1 < this.size +1 && j-1 > 0) {
  13. this.board[j][i].list_of_neighbors[Field.Direction.LU.ordinal()] = this.board[j-1][i+1];
  14. }
  15. if (j+1 < this.size + 1) {
  16. this.board[j][i].list_of_neighbors[Field.Direction.R.ordinal()] = this.board[j+1][i];
  17. }
  18. if (i-1 > 0 && j+1 < this.size + 1) {
  19. this.board[j][i].list_of_neighbors[Field.Direction.RD.ordinal()] = this.board[j+1][i-1];
  20. }
  21. if (i+1 < this.size + 1 && j+1 < this.size + 1) {
  22. this.board[j][i].list_of_neighbors[Field.Direction.RU.ordinal()] = this.board[j+1][i+1];
  23.  
  24. }
  25. if(i+1 < this.size + 1) {
  26. this.board[j][i].list_of_neighbors[Field.Direction.U.ordinal()] = this.board[j][i+1];
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement