Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- or (int i = 1; i < size+1; i++) {
- for(int j = 1; j < size+1; j++) {
- if (i-1 > 0) {
- this.board[j][i].list_of_neighbors[Field.Direction.D.ordinal()] = this.board[j][i-1];
- }
- if (j-1 > 0) {
- this.board[j][i].list_of_neighbors[Field.Direction.L.ordinal()] = this.board[j-1][i];
- }
- if (i-1 > 0 && j-1 > 0) {
- this.board[j][i].list_of_neighbors[Field.Direction.LD.ordinal()] = this.board[j-1][i-1];
- }
- if (i+1 < this.size +1 && j-1 > 0) {
- this.board[j][i].list_of_neighbors[Field.Direction.LU.ordinal()] = this.board[j-1][i+1];
- }
- if (j+1 < this.size + 1) {
- this.board[j][i].list_of_neighbors[Field.Direction.R.ordinal()] = this.board[j+1][i];
- }
- if (i-1 > 0 && j+1 < this.size + 1) {
- this.board[j][i].list_of_neighbors[Field.Direction.RD.ordinal()] = this.board[j+1][i-1];
- }
- if (i+1 < this.size + 1 && j+1 < this.size + 1) {
- this.board[j][i].list_of_neighbors[Field.Direction.RU.ordinal()] = this.board[j+1][i+1];
- }
- if(i+1 < this.size + 1) {
- this.board[j][i].list_of_neighbors[Field.Direction.U.ordinal()] = this.board[j][i+1];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement