Przerobiłam ten programik z pascala ale wyskakuje mi cały czas bład nie wiem co jest źle moze mi ktoś pomóc, o to kod programu :
with Ada.Text_Io;
use Ada.Text_Io;
with Ada.Integer_Text_Io;
use Ada.Integer_Text_Io;
procedure Skoczek is
Nmax : constant Integer := 20;
I,
J : Integer;
N : Integer;
Pocz1,
Pocz2 : Integer;
Ok : Boolean;
Ruchy : array (Integer range 1 .. 8, Integer range 1 .. 2) of Integer;
Szach : array (1 .. Nmax, 1 .. Nmax) of Integer;
procedure Ruch (
I,
Wsp1,
Wsp2 : Integer;
Ok : out Boolean ) is
Wspnast1,
Wspnast2,
Nr : Integer;
Okwewn : Boolean;
begin
Nr:=0;
loop
Nr:=Nr+1;
Okwewn:=False;
Put(Wspnast1);
Put(" ");
Put(Wspnast2);
Put(" ");
Wspnast1:=Wspnast1 + Ruchy(Nr,1);
Wspnast2:=Wspnast2 + Ruchy(Nr,2);
if (Wspnast1 in 1..N) and (Wspnast2 in 1..N) then
if Szach(Wspnast1,Wspnast2)=0 then
Szach(Wspnast1,Wspnast2):=I;
if I<N*N then
Ruch(I+1, Wspnast1,Wspnast2,Okwewn);
if not Okwewn then
Szach(Wspnast1,Wspnast2):=0;
end if;
else
Okwewn:=True;
end if;
exit when Okwewn or (Nr=8);
Ok:=Okwewn;
end if;
end if;
end loop;
end Ruch;
begin
Ruchy (1,1) := -2;
Ruchy(1,2) := 1;
Ruchy(2,1) := -1;
Ruchy(2,2) := 2;
Ruchy(3,1) := 1;
Ruchy(3,2) := 2;
Ruchy(4,1) := 2;
Ruchy(4,2) := 1;
Ruchy(5,1) := 2;
Ruchy(5,2) := -1;
Ruchy(6,1) := 1;
Ruchy(6,2) := -2;
Ruchy(7,1) := -1;
Ruchy(7,2) := -2;
Ruchy(8,1) := -2;
Ruchy(8,2) := -1;
Put("Podaj rozmiar szachownicy");
Get(N);
Put("Podaj punkty poczatkowa pierwsza ");
Get(Pocz1);
Put("Podaj wspolrzedne poczatkowa druga");
Get(Pocz2);
if not (N in 1..Nmax) or not (Pocz1 in 1..N) or not (Pocz2 in 1..N) then
Put("blad danych");
end if;
for I in 1..N loop
for J in 1..N loop
Szach(I,J):=0;
Szach(Pocz1,Pocz2):=1;
Ruch(2,Pocz1,Pocz2,Ok);
end loop;
end loop;
if Ok then
for I in 1..N loop
for J in 1..N loop
Put(Szach(I,J));
end loop;
end loop;
else
Put("brak rozwiazania");
end if;
end Skoczek;