Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TForm1.desno(x,y,tip:integer):integer;
- var br:integer;
- begin
- br:=0;
- if tip=1 then
- begin
- if x+1<=9 then
- begin
- if pShots[x,y]=1 then
- br:=1+desno(x+1,y,1)
- else br:=0;
- end
- else br:=0;
- end;
- if tip=2 then
- begin
- if x+1<=9 then
- begin
- if cShots[x,y]=1 then
- br:=1+desno(x+1,y,2)
- else br:=0;
- end
- else br:=0;
- end;
- desno:=br-1;
- end;
- function TForm1.levo(x,y,tip:integer):integer;
- var br:integer;
- begin
- br:=0;
- if tip=1 then
- begin
- if x-1>=0 then
- begin
- if pShots[x,y]=1 then
- br:=1+levo(x-1,y,1)
- else br:=0;
- end
- else br:=0;
- end;
- if tip=2 then
- begin
- if x-1>=0 then
- begin
- if cShots[x,y]=1 then
- br:=1+levo(x-1,y,2)
- else br:=0;
- end
- else br:=0;
- end;
- levo:=br-1;
- end;
- function TForm1.gore(x,y,tip:integer):integer;
- var br:integer;
- begin
- br:=0;
- if tip=1 then
- begin
- if y-1>=0 then
- begin
- if pShots[x,y]=1 then
- br:=1+gore(x,y-1,1)
- else br:=0;
- end
- else br:=0;
- end;
- if tip=2 then
- begin
- if y-1>=0 then
- begin
- if cShots[x,y]=1 then
- br:=1+gore(x,y-1,2)
- else br:=0;
- end
- else br:=0;
- end;
- gore:=br-1;
- end;
- function TForm1.dole(x,y,tip:integer):integer;
- var br:integer;
- begin
- br:=0;
- if tip=1 then
- begin
- if y+1<=9 then
- begin
- if pShots[x,y]=1 then
- br:=1+dole(x,y+1,1)
- else br:=0;
- end
- else br:=0;
- end;
- if tip=2 then
- begin
- if y+1<=9 then
- begin
- if cShots[x,y]=1 then
- br:=1+dole(x,y+1,2)
- else br:=0;
- end
- else br:=0;
- end;
- dole:=br-1;
- end;
- function TForm1.isPotopljen(x,y,tip:integer):boolean;
- begin
- if tip=1 then
- begin
- if (gore(x,y,1)+dole(x,y,1)+1=cBoard[x,y])or(levo(x,y,1)+desno(x,y,1)+1=cBoard[x,y])then
- isPotopljen:=true
- else isPotopljen:=false;
- end;
- if tip=2 then
- begin
- if (1+gore(x,y,2)+dole(x,y,2)=pBoard[x,y])or(1+levo(x,y,2)+desno(x,y,2)=pBoard[x,y])then
- isPotopljen:=true
- else isPotopljen:=false;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement