Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool geenaanval (int rij, int stand[ ], int welke, int damekolom) {
- // welke = welke dame we huidig mee bezig zijn
- bool veilig = true;
- int hulprij = 1;
- if(welke <= n){
- ydame = rij;
- xdame = stand[rij];
- }//if
- else if(welke > n){
- ydame = (n+2);
- xdame = (n+1);
- }//else if
- while (veilig && (hulprij < rij)) {
- veilig = ((stand[rij] != stand[hulprij]) &&
- ((stand[rij]-stand[hulprij]) != rij-hulprij) &&
- ((stand[rij]-stand[hulprij]) != hulprij-rij));
- if( !veilig && ( (ydame < (n+3)) && (xdame > (n+3)) ){
- veilig = true;
- }//if
- for( int hulpkolom = 1; hulpkolom <= n; hulpkolom++){
- if( (!veilig && (damekolom == stand[hulpkolom])) && ( ((ydame < (n+4)) && (hulpkolom > (n+4)) ) || ( ((ydame > (n+4)) && (hulpkolom < (n+4)) ) ){
- veilig = true;
- }//if
- }//for
- hulprij++;
- }//while
- return veilig;
- }//geenaanval
Advertisement
Add Comment
Please, Sign In to add comment