이 코드가 실행되지 않는 이유는 무엇입니까? 그런데루프 및 논리 AND + OR
for(int i=0;i<11;i++){
for(int j=0;j<11;j++){
if(i>0){
if((staticWallLoc[i--][j]&4)>0){staticWallLoc[i][j]=staticWallLoc[i][j]|1;}
}
if(j<10){
if((staticWallLoc[i][j++]&8)>0){staticWallLoc[i][j]=staticWallLoc[i][j]|2;}
}
if(i<10){
if((staticWallLoc[i++][j]&1)>0){staticWallLoc[i][j]=staticWallLoc[i][j]|4;}
}
if(j>0){
if((staticWallLoc[i][j--]&2)>0){staticWallLoc[i][j]=staticWallLoc[i][j]|8;}
}
System.out.println(i+" "+j);
}
}
는 staticWallLoc [11] [11] 각 차원 (0-10) 11 개 인덱스가 이차원 배열이다.
왜 내 프로그램이 문자 그대로이 코드를 전달할 수 없는지 궁금합니다.
매번 조작 할 수있는 아주 좋은 생각이 아니다. 디버거를 사용해 보셨습니까 ?? –
루프 인덱스의 증가 및 감소 게시물은 끔찍합니다! i-1과 i + 1 등을 색인으로 사용하십시오. – John3136
@ John3136 난 그냥 질문에 대답했다고 생각;) – MadProgrammer