heres my problem: its not working, and i dont know how to make ia, so i made...an if thingie that should work. but it doesnt. it theroreticly checks all the spaces in the vicinity of the "peice" on the board "world[10][10];" the coordinates of the peice are world[aifx][aify]; it also couts the board using loops.
an example of board cout:
the if checker...Code:for ( x = 0 ; x < 10 ; x++ ){ if (world[x][1] == 1) cout<<"[#]"; if(world[x][1]==2) cout<<"[$]"; else if (world[x][1] == 0) cout<<"[ ]"; }
Code:if(world[aifx][aify]==2){ if(1>1000){} else if(world[aifx+1][aify]==1){ chooser=1 ; } else if(world[aifx+2][aify]==1){ chooser=2 ; } else if(world[aifx-1][aify]==1){ chooser=3 ; } else if(world[aifx-2][aify]==1){ chooser=4 ; } else if(world[aifx][aify+1]==1){ chooser=5 ; } else if(world[aifx][aify+2]==1){ chooser=6 ; } else if(world[aifx][aify-2]==1){ chooser=7 ; } else if(world[aifx][aify-1]==1){ chooser=8 ; } else if(world[aifx+1][aify+1]==1){ chooser=9 ; } else if(world[aifx+1][aify-1]==1){ chooser=10 ; } else if(world[aifx-1][aify-1]==1){ chooser=11 ; } else if(world[aifx-1][aify+1]==1){ chooser=12 ; } switch (chooser){ case 1: aifx=aifx+1; break; case 2: aifx=aifx+1; break; case 3 : aifx=aifx-1; break; case 4: aifx=aifx-1; break; case 5: aify=aify+1; break; case 6: aify=aify+1; break; case 7: aify=aify-1; break; case 8: aify=aify-1; break; case 9: aifx=aifx+1; break; case 10: aifx=aifx+1; break; case 11: aify=aify-1; break; case 12: aify=aify+1; break; } }