Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool pass(cell gamefield[9][9], int startx,int starty, int endx, int endy)
- {
- bool up,down,left,right;
- gamefield[startx][starty].busy = true;
- if ((startx == endx) && (starty == endy)) return true;
- else
- {
- if ((starty>0) && (gamefield[startx][starty-1].busy == false)) up = pass(gamefield,startx,starty-1,endx,endy);
- else up = false;
- if ((startx>0) && (gamefield[startx-1][starty].busy == false)) left = pass(gamefield,startx-1,starty,endx,endy);
- else left = false;
- if ((starty<8) && (gamefield[startx][starty+1].busy == false)) down = pass(gamefield,startx,starty+1,endx,endy);
- else down = false;
- if ((startx<0) && (gamefield[startx+1][starty].busy == false)) right = pass(gamefield,startx+1,starty,endx,endy);
- else up = false;
- return(up || down || left || right);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement