init for p15

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
procedure init;begin;
check:=false;
num:=random(15)+1;
for var i:=1 to 15 do m[i]:=inttostr(i);
for var i:=1 to 15 do begin
res[i]:=m[i];
if i=num then check:=true;
if check=true then begin
if i=num then res[i]:='empty';
if i<>num then res[i]:=m[i-1];
end;
end;
for var i:=1 to 15 do m[i]:=res[i];
for var i:=1 to 150 do swap(m[random(15)+1],m[random(15)+1]);
for var i:=1 to 15 do writeln(m[i]);
end;