summaryrefslogtreecommitdiff
path: root/raetselunit.inc
diff options
context:
space:
mode:
Diffstat (limited to 'raetselunit.inc')
-rw-r--r--raetselunit.inc529
1 files changed, 265 insertions, 264 deletions
diff --git a/raetselunit.inc b/raetselunit.inc
index 5b7ffe0..190ab73 100644
--- a/raetselunit.inc
+++ b/raetselunit.inc
@@ -42,7 +42,7 @@ begin
result:='-'
{$IFDEF hochhaus}
else
- result:=inttostr(i);
+ result:=intToStr(i);
{$ENDIF}
{$IFDEF buchstaben}
else begin
@@ -89,76 +89,76 @@ end;
{$IFDEF passt}
// function tHochhausRaetsel.passt(spalte,zeile: integer): boolean;
var
- I,KZ,KS: Integer;
- W,S,K: Longint;
+ i,KZ,KS: integer;
+ w,s,k: longint;
begin
- W:=0;
- S:=0;
- K:=0;
+ w:=0;
+ s:=0;
+ k:=0;
if sudokuCB.checked then begin
- KZ:=(Zeile div NSqrt)*NSqrt;
- KS:=(Spalte div NSqrt)*NSqrt;
- for I:=0 to dim-1 do begin
+ KZ:=(zeile div nSqrt)*nSqrt;
+ KS:=(spalte div nSqrt)*nSqrt;
+ for i:=0 to dim-1 do begin
{$IFDEF buchstaben}
- W:=W*(groeszen[0]+2)+inhalt[Zeile*dim+I]+1;
- S:=S*(groeszen[0]+2)+inhalt[I*dim+Spalte]+1;
- K:=K*(groeszen[0]+2)+inhalt[(KZ+(I div NSqrt))*dim+KS+(I mod NSqrt)]+1;
+ w:=w*(groeszen[0]+2)+inhalt[zeile*dim+i]+1;
+ s:=s*(groeszen[0]+2)+inhalt[i*dim+spalte]+1;
+ k:=k*(groeszen[0]+2)+inhalt[(KZ+(i div nSqrt))*dim+KS+(i mod nSqrt)]+1;
{$ENDIF}
{$IFDEF hochhaus}
- W:=W*(dim+1)+max(0,inhalt[Zeile*dim+I]);
- S:=S*(dim+1)+max(0,inhalt[I*dim+Spalte]);
- K:=K*(dim+1)+max(0,inhalt[(KZ+(I div NSqrt))*dim+KS+(I mod NSqrt)]);
+ w:=w*(dim+1)+max(0,inhalt[zeile*dim+i]);
+ s:=s*(dim+1)+max(0,inhalt[i*dim+spalte]);
+ k:=k*(dim+1)+max(0,inhalt[(KZ+(i div nSqrt))*dim+KS+(i mod nSqrt)]);
{$ENDIF}
end;
result:=
- AMoeglich[K*(groeszen[0]+1)] and
- EMoeglich[S*(groeszen[0]+1)+max(0,Rand[Spalte])] and
- AMoeglich[W*(groeszen[0]+1)+max(0,Rand[dim+Zeile])] and
- AMoeglich[S*(groeszen[0]+1)+max(0,Rand[2*dim+Spalte])] and
- EMoeglich[W*(groeszen[0]+1)+max(0,Rand[3*dim+Zeile])];
+ AMoeglich[k*(groeszen[0]+1)] and
+ EMoeglich[s*(groeszen[0]+1)+max(0,rand[spalte])] and
+ AMoeglich[w*(groeszen[0]+1)+max(0,rand[dim+zeile])] and
+ AMoeglich[s*(groeszen[0]+1)+max(0,rand[2*dim+spalte])] and
+ EMoeglich[w*(groeszen[0]+1)+max(0,rand[3*dim+zeile])];
end
else begin
- for I:=0 to dim-1 do begin
+ for i:=0 to dim-1 do begin
{$IFDEF buchstaben}
- W:=W*(groeszen[0]+2)+inhalt[Zeile*dim+I]+1;
- S:=S*(groeszen[0]+2)+inhalt[I*dim+Spalte]+1;
+ w:=w*(groeszen[0]+2)+inhalt[zeile*dim+i]+1;
+ s:=s*(groeszen[0]+2)+inhalt[i*dim+spalte]+1;
{$ENDIF}
{$IFDEF hochhaus}
- W:=W*(dim+1)+max(0,inhalt[Zeile*dim+I]);
- S:=S*(dim+1)+max(0,inhalt[I*dim+Spalte]);
+ w:=w*(dim+1)+max(0,inhalt[zeile*dim+i]);
+ s:=s*(dim+1)+max(0,inhalt[i*dim+spalte]);
{$ENDIF}
end;
result:=
- EMoeglich[S*(groeszen[0]+1)+max(0,Rand[Spalte])] and
- AMoeglich[W*(groeszen[0]+1)+max(0,Rand[dim+Zeile])] and
- AMoeglich[S*(groeszen[0]+1)+max(0,Rand[2*dim+Spalte])] and
- EMoeglich[W*(groeszen[0]+1)+max(0,Rand[3*dim+Zeile])];
+ EMoeglich[s*(groeszen[0]+1)+max(0,rand[spalte])] and
+ AMoeglich[w*(groeszen[0]+1)+max(0,rand[dim+zeile])] and
+ AMoeglich[s*(groeszen[0]+1)+max(0,rand[2*dim+spalte])] and
+ EMoeglich[w*(groeszen[0]+1)+max(0,rand[3*dim+zeile])];
end;
if diagonalenCB.checked then begin
- if Zeile=Spalte then begin
- W:=0;
+ if zeile=spalte then begin
+ w:=0;
{$IFDEF buchstaben}
- for I:=0 to dim-1 do
- W:=W*(groeszen[0]+2)+inhalt[I*(dim+1)]+1;
- Result:=Result and AMoeglich[W*(groeszen[0]+1)];
+ for i:=0 to dim-1 do
+ w:=w*(groeszen[0]+2)+inhalt[i*(dim+1)]+1;
+ result:=result and AMoeglich[w*(groeszen[0]+1)];
{$ENDIF}
{$IFDEF hochhaus}
- for I:=0 to dim-1 do
- W:=W*(dim+1)+max(0,inhalt[I*(dim+1)]);
- result:=result and AMoeglich[W*(dim+1)];
+ for i:=0 to dim-1 do
+ w:=w*(dim+1)+max(0,inhalt[i*(dim+1)]);
+ result:=result and AMoeglich[w*(dim+1)];
{$ENDIF}
end;
- if Zeile+Spalte=dim-1 then begin
- W:=0;
+ if zeile+spalte=dim-1 then begin
+ w:=0;
{$IFDEF buchstaben}
- for I:=0 to dim-1 do
- W:=W*(groeszen[0]+2)+inhalt[(I+1)*(dim-1)]+1;
- Result:=Result and AMoeglich[W*(groeszen[0]+1)];
+ for i:=0 to dim-1 do
+ w:=w*(groeszen[0]+2)+inhalt[(i+1)*(dim-1)]+1;
+ result:=result and AMoeglich[w*(groeszen[0]+1)];
{$ENDIF}
{$IFDEF hochhaus}
- for I:=0 to dim-1 do
- W:=W*(dim+1)+max(0,inhalt[(I+1)*(dim-1)]);
- Result:=Result and AMoeglich[W*(dim+1)];
+ for i:=0 to dim-1 do
+ w:=w*(dim+1)+max(0,inhalt[(i+1)*(dim-1)]);
+ result:=result and AMoeglich[w*(dim+1)];
{$ENDIF}
end;
end;
@@ -175,7 +175,7 @@ begin
for j:=0 to dim-1 do
if (not passt(i,j)) or (inhalt[i+dim*j]<0)
{$IFDEF hochhaus}
- or (inhalt[I+dim*j]=0)
+ or (inhalt[i+dim*j]=0)
{$ENDIF}
then exit;
result:=true;
@@ -185,16 +185,16 @@ end;
{$IFDEF gesamtRaenderErzeugen}
// procedure tHochhausRaetsel.gesamtRaenderErzeugen;
var
- I,J,K,Nullen: Integer;
+ i,j,k,nullen: integer;
{$IFNDEF buchstaben}
AZ,
{$ENDIF}
- AR: Integer;
- AK,EK,NAK,NEK: Longint;
- Nums: tLongintArray;
- B: Boolean;
- Basis,Faktor: Integer;
- Schritt: Longint;
+ AR: integer;
+ AK,EK,NAK,NEK: longint;
+ nums: tLongintArray;
+ b: boolean;
+ Basis,faktor: integer;
+ schritt: longint;
dat: file;
buff: array of byte;
lw: Cardinal;
@@ -207,47 +207,47 @@ const dat_name =
'Hochhausraetsel.dat';
{$ENDIF}
-function calcNums(I: Longint): tLongintArray;
+function calcNums(i: longint): tLongintArray;
var
- J: Integer;
+ j: integer;
begin
- Setlength(Result,dim);
- For J:=0 to dim-1 do begin
- Result[J]:=I mod Basis;
- I:=I div Basis;
+ setLength(result,dim);
+ for j:=0 to dim-1 do begin
+ result[j]:=i mod Basis;
+ i:=i div Basis;
end;
end;
-function calcIndex(Nums: TLongintArray): Longint;
+function calcIndex(nums: tLongintArray): longint;
var
j: integer;
begin
- Result:=0;
- For j:=0 to dim-1 do
- Result:=Result*Basis + Nums[dim-J-1];
+ result:=0;
+ for j:=0 to dim-1 do
+ result:=result*Basis + nums[dim-j-1];
end;
-function swapIndex(I: Longint): Longint;
+function swapIndex(i: longint): longint;
var
j: integer;
begin
- Result:=0;
- for J:=0 to dim-1 do begin
- Result:=Result*Basis+(I mod Basis);
- I:=I div Basis;
+ result:=0;
+ for j:=0 to dim-1 do begin
+ result:=result*Basis+(i mod Basis);
+ i:=i div Basis;
end;
end;
begin
{$IFDEF buchstaben}
Basis:=groeszen[0]+2;
- Faktor:=groeszen[0]+1;
+ faktor:=groeszen[0]+1;
{$ENDIF}
{$IFDEF hochhaus}
Basis:=dim+1;
- Faktor:=dim+1;
+ faktor:=dim+1;
{$ENDIF}
- AK:=round(power(Basis,dim)*Faktor);
+ AK:=round(power(Basis,dim)*faktor);
if (length(AMoeglich) = AK) and
(length(EMoeglich) = AK) then
@@ -255,20 +255,20 @@ begin
lw:=0; // silence warning
- if fileexists(extractfilepath(application.exename)+dat_name) then begin
- assignfile(dat,extractfilepath(application.exename)+dat_name);
+ if fileExists(extractFilePath(application.exeName)+dat_name) then begin
+ assignFile(dat,extractFilePath(application.exeName)+dat_name);
reset(dat,1);
while not eof(dat) do begin
- blockread(dat,lw,sizeof(lw));
+ blockRead(dat,lw,sizeOf(lw));
if lw=AK then begin
- Setlength(AMoeglich,AK);
- Setlength(EMoeglich,AK);
- setlength(buff,(lw+7) div 8);
- blockread(dat,buff[0],length(buff));
+ setLength(AMoeglich,AK);
+ setLength(EMoeglich,AK);
+ setLength(buff,(lw+7) div 8);
+ blockRead(dat,buff[0],length(buff));
for i:=0 to length(buff)-1 do
for j:=0 to min(7,length(AMoeglich)-8*i-1) do
AMoeglich[8*i+j]:=odd(buff[i] shr j);
- blockread(dat,buff[0],length(buff));
+ blockRead(dat,buff[0],length(buff));
for i:=0 to length(buff)-1 do
for j:=0 to min(7,length(EMoeglich)-8*i-1) do
EMoeglich[8*i+j]:=odd(buff[i] shr j);
@@ -277,120 +277,120 @@ begin
else
seek(dat,filepos(dat)+2*((lw + 7) div 8));
end;
- closefile(dat);
+ closeFile(dat);
end;
- Progressbar1.Visible:=true;
- Progressbar1.Min:=0;
- Progressbar1.Max:=1000;
- Progressbar1.Position:=0;
- Application.ProcessMessages;
-
- Setlength(AMoeglich,AK);
- Setlength(EMoeglich,AK);
- For AK:=0 to length(AMoeglich)-1 do begin
- AMoeglich[AK]:=False;
- EMoeglich[AK]:=False;
+ progressBar1.visible:=true;
+ progressBar1.min:=0;
+ progressBar1.max:=1000;
+ progressBar1.position:=0;
+ application.processMessages;
+
+ setLength(AMoeglich,AK);
+ setLength(EMoeglich,AK);
+ for AK:=0 to length(AMoeglich)-1 do begin
+ AMoeglich[AK]:=false;
+ EMoeglich[AK]:=false;
end;
- Setlength(Nums,0);
+ setLength(nums,0);
- Schritt:=max(1,round((length(AMoeglich) div Faktor) / Progressbar1.Max));
- For AK:=0 to length(AMoeglich) div Faktor -1 do begin
- if AK mod Schritt = 0 then begin
- progressbar1.stepIt;
+ schritt:=max(1,round((length(AMoeglich) div faktor) / progressBar1.max));
+ for AK:=0 to length(AMoeglich) div faktor -1 do begin
+ if AK mod schritt = 0 then begin
+ progressBar1.stepIt;
application.processMessages;
end;
- Nums:=calcNums(AK);
- B:=true;
+ nums:=calcNums(AK);
+ b:=true;
{$IFDEF buchstaben}
- Nullen:=groeszen[1];
- For I:=0 to length(Nums)-1 do begin
- B:=B and (Nums[I]<>0);
- if Nums[I]=1 then
- dec(Nullen)
+ nullen:=groeszen[1];
+ for i:=0 to length(nums)-1 do begin
+ b:=b and (nums[i]<>0);
+ if nums[i]=1 then
+ dec(nullen)
else
- for J:=0 to I-1 do
- B:=B and (Nums[I]<>Nums[J]);
+ for j:=0 to i-1 do
+ b:=b and (nums[i]<>nums[j]);
end;
- B:=B and (Nullen>=0);
+ b:=b and (nullen>=0);
{$ENDIF}
{$IFDEF hochhaus}
- For I:=0 to length(Nums)-1 do begin
- B:=B and (Nums[I]<>0);
- for J:=0 to I-1 do
- B:=B and (Nums[I]<>Nums[J]);
+ for i:=0 to length(nums)-1 do begin
+ b:=b and (nums[i]<>0);
+ for j:=0 to i-1 do
+ b:=b and (nums[i]<>nums[j]);
end;
{$ENDIF}
- if B then begin
+ if b then begin
EK:=swapIndex(AK);
AR:=0;
{$IFNDEF buchstaben}
AZ:=0;
{$ENDIF}
- For I:=0 to dim-1 do begin
+ for i:=0 to dim-1 do begin
{$IFDEF buchstaben}
- if Nums[I]>1 then begin
- AR:=Nums[I]-1;
+ if nums[i]>1 then begin
+ AR:=nums[i]-1;
break;
end;
{$ENDIF}
{$IFDEF hochhaus}
- if Nums[I]>AZ then begin
+ if nums[i]>AZ then begin
inc(AR);
- AZ:=Nums[I];
+ AZ:=nums[i];
end;
{$ENDIF}
end;
- AMoeglich[AK*Faktor+AR]:=true;
- EMoeglich[EK*Faktor+AR]:=true;
- AMoeglich[AK*Faktor]:=true;
- EMoeglich[EK*Faktor]:=true;
+ AMoeglich[AK*faktor+AR]:=true;
+ EMoeglich[EK*faktor+AR]:=true;
+ AMoeglich[AK*faktor]:=true;
+ EMoeglich[EK*faktor]:=true;
end;
end;
- Progressbar1.Position:=0;
- Schritt:=Max(round(((length(AMoeglich) div Faktor)*dim) / Progressbar1.Max),1);
- For Nullen:=1 to dim do
- For AK:=0 to length(AMoeglich) div Faktor -1 do begin
- if AK mod Schritt = 0 then begin
- progressbar1.stepIt;
+ progressBar1.position:=0;
+ schritt:=max(round(((length(AMoeglich) div faktor)*dim) / progressBar1.max),1);
+ for nullen:=1 to dim do
+ for AK:=0 to length(AMoeglich) div faktor -1 do begin
+ if AK mod schritt = 0 then begin
+ progressBar1.stepIt;
application.processMessages;
end;
- Nums:=calcNums(AK);
- J:=Nullen;
- For I:=0 to dim-1 do
- if Nums[I]=0 then
- dec(J);
- if J<>0 then
+ nums:=calcNums(AK);
+ j:=nullen;
+ for i:=0 to dim-1 do
+ if nums[i]=0 then
+ dec(j);
+ if j<>0 then
continue;
EK:=swapIndex(AK);
- For I:=0 to dim-1 do
- if Nums[I]=0 then begin
- For J:=1 to Basis-1 do begin
- Nums[I]:=J;
- NAK:=calcIndex(Nums);
+ for i:=0 to dim-1 do
+ if nums[i]=0 then begin
+ for j:=1 to Basis-1 do begin
+ nums[i]:=j;
+ NAK:=calcIndex(nums);
NEK:=swapIndex(NAK);
- For K:=0 to Faktor-1 do begin
- AMoeglich[AK*Faktor+K]:=AMoeglich[AK*Faktor+K] or AMoeglich[NAK*Faktor+K];
- EMoeglich[EK*Faktor+K]:=EMoeglich[EK*Faktor+K] or EMoeglich[NEK*Faktor+K];
+ for k:=0 to faktor-1 do begin
+ AMoeglich[AK*faktor+k]:=AMoeglich[AK*faktor+k] or AMoeglich[NAK*faktor+k];
+ EMoeglich[EK*faktor+k]:=EMoeglich[EK*faktor+k] or EMoeglich[NEK*faktor+k];
end;
end;
break;
end;
end;
- Progressbar1.Visible:=False;
+ progressBar1.visible:=false;
- assignfile(dat,extractfilepath(application.exename)+dat_name);
- if fileexists(extractfilepath(application.exename)+dat_name) then begin
+ assignFile(dat,extractFilePath(application.exeName)+dat_name);
+ if fileExists(extractFilePath(application.exeName)+dat_name) then begin
reset(dat,1);
- seek(dat,filesize(dat));
+ seek(dat,fileSize(dat));
end
else
rewrite(dat,1);
lw:=length(AMoeglich);
- blockWrite(dat,lw,sizeof(lw));
- setlength(buff,(length(AMoeglich)+7) div 8);
+ blockWrite(dat,lw,sizeOf(lw));
+ setLength(buff,(length(AMoeglich)+7) div 8);
for i:=0 to length(buff)-1 do begin
buff[i]:=0;
for j:=0 to min(7,length(AMoeglich)-8*i-1) do
@@ -403,108 +403,108 @@ begin
buff[i]:=buff[i] or (byte(EMoeglich[8*i+j]) shl j);
end;
blockWrite(dat,buff[0],length(buff));
- closefile(dat);
+ closeFile(dat);
end;
{$ENDIF}
{$IFDEF passtZumZeichnen}
// function tHochhausRaetsel.passtZumZeichnen(spalte,zeile: integer): boolean;
var
- I,KS,KZ: Integer;
- W,S: Longint;
+ i,KS,KZ: integer;
+ w,s: longint;
begin
result:=false;
if (spalte>=0) and (zeile>=0) and (spalte<dim) and (zeile<dim) then begin // im inneren
{$IFDEF buchstaben}
- if inhalt[Zeile*dim+Spalte]=-1 then
+ if inhalt[zeile*dim+spalte]=-1 then
exit;
{$ENDIF}
{$IFDEF hochhaus}
- if inhalt[Zeile*dim+Spalte]<=0 then
+ if inhalt[zeile*dim+spalte]<=0 then
exit;
{$ENDIF}
- W:=0;
- S:=0;
- for I:=0 to dim-1 do begin
+ w:=0;
+ s:=0;
+ for i:=0 to dim-1 do begin
{$IFDEF buchstaben}
- W:=W*(groeszen[0]+2)+inhalt[Zeile*dim+I]+1;
- S:=S*(groeszen[0]+2)+inhalt[I*dim+Spalte]+1;
+ w:=w*(groeszen[0]+2)+inhalt[zeile*dim+i]+1;
+ s:=s*(groeszen[0]+2)+inhalt[i*dim+spalte]+1;
{$ENDIF}
{$IFDEF hochhaus}
- W:=W*(dim+1)+max(0,inhalt[Zeile*dim+I]);
- S:=S*(dim+1)+max(0,inhalt[I*dim+Spalte]);
+ w:=w*(dim+1)+max(0,inhalt[zeile*dim+i]);
+ s:=s*(dim+1)+max(0,inhalt[i*dim+spalte]);
{$ENDIF}
end;
- Result:=
- EMoeglich[S*(groeszen[0]+1)+max(0,Rand[Spalte])] and
- AMoeglich[W*(groeszen[0]+1)+max(0,Rand[dim+Zeile])] and
- AMoeglich[S*(groeszen[0]+1)+max(0,Rand[2*dim+Spalte])] and
- EMoeglich[W*(groeszen[0]+1)+max(0,Rand[3*dim+Zeile])];
+ result:=
+ EMoeglich[s*(groeszen[0]+1)+max(0,rand[spalte])] and
+ AMoeglich[w*(groeszen[0]+1)+max(0,rand[dim+zeile])] and
+ AMoeglich[s*(groeszen[0]+1)+max(0,rand[2*dim+spalte])] and
+ EMoeglich[w*(groeszen[0]+1)+max(0,rand[3*dim+zeile])];
{$IFDEF buchstaben}
- if inhalt[Zeile*dim+Spalte]=0 then
- W:=groeszen[1]
+ if inhalt[zeile*dim+spalte]=0 then
+ w:=groeszen[1]
else
{$ENDIF}
- W:=1;
+ w:=1;
if diagonalenCB.checked then begin
- if Zeile=Spalte then begin
- S:=W;
- for I:=0 to dim-1 do
- if (I<>Zeile) and (inhalt[I*(dim+1)]=inhalt[Zeile*dim+Spalte]) then
- dec(S);
- Result:=Result and (S>0);
+ if zeile=spalte then begin
+ s:=w;
+ for i:=0 to dim-1 do
+ if (i<>zeile) and (inhalt[i*(dim+1)]=inhalt[zeile*dim+spalte]) then
+ dec(s);
+ result:=result and (s>0);
end;
- if Zeile+Spalte=dim-1 then begin
- S:=W;
- For I:=0 to dim-1 do
- if (I<>Zeile) and (inhalt[(I+1)*(dim-1)]=inhalt[Zeile*dim+Spalte]) then
- dec(S);
- Result:=Result and (S>0);
+ if zeile+spalte=dim-1 then begin
+ s:=w;
+ for i:=0 to dim-1 do
+ if (i<>zeile) and (inhalt[(i+1)*(dim-1)]=inhalt[zeile*dim+spalte]) then
+ dec(s);
+ result:=result and (s>0);
end;
end;
if sudokuCB.checked then begin
- KZ:=(Zeile div NSqrt)*NSqrt;
- KS:=(Spalte div NSqrt)*NSqrt;
- S:=W+1;
- For I:=0 to dim-1 do
- if inhalt[(KZ+(I div NSqrt))*dim+KS+(I mod NSqrt)]=inhalt[Zeile*dim+Spalte] then
- dec(S);
- Result:=Result and (S>0);
+ KZ:=(zeile div nSqrt)*nSqrt;
+ KS:=(spalte div nSqrt)*nSqrt;
+ s:=w+1;
+ for i:=0 to dim-1 do
+ if inhalt[(KZ+(i div nSqrt))*dim+KS+(i mod nSqrt)]=inhalt[zeile*dim+spalte] then
+ dec(s);
+ result:=result and (s>0);
end;
- S:=W;
- For I:=0 to dim-1 do
- if (I<>Zeile) and (inhalt[I*dim+Spalte]=inhalt[Zeile*dim+Spalte]) then
- dec(S);
- Result:=Result and (S>0);
- S:=W;
- For I:=0 to dim-1 do
- if (I<>Spalte) and (inhalt[Zeile*dim+I]=inhalt[Zeile*dim+Spalte]) then
- dec(S);
- Result:=Result and (S>0);
+ s:=w;
+ for i:=0 to dim-1 do
+ if (i<>zeile) and (inhalt[i*dim+spalte]=inhalt[zeile*dim+spalte]) then
+ dec(s);
+ result:=result and (s>0);
+ s:=w;
+ for i:=0 to dim-1 do
+ if (i<>spalte) and (inhalt[zeile*dim+i]=inhalt[zeile*dim+spalte]) then
+ dec(s);
+ result:=result and (s>0);
end
- else begin // auf dem Rand
+ else begin // auf dem rand
if zeile=-1 then begin
if rand[spalte]=-1 then
exit;
s:=0;
- for I:=0 to dim-1 do begin
+ for i:=0 to dim-1 do begin
{$IFDEF buchstaben}
- S:=S*(groeszen[0]+2)+inhalt[I*dim+Spalte]+1;
+ s:=s*(groeszen[0]+2)+inhalt[i*dim+spalte]+1;
{$ENDIF}
{$IFDEF hochhaus}
- S:=S*(dim+1)+max(0,inhalt[I*dim+Spalte]);
+ s:=s*(dim+1)+max(0,inhalt[i*dim+spalte]);
{$ENDIF}
end;
result:=
- EMoeglich[S*(groeszen[0]+1)+max(0,Rand[Spalte])] or
- not EMoeglich[S*(groeszen[0]+1)];
+ EMoeglich[s*(groeszen[0]+1)+max(0,rand[spalte])] or
+ not EMoeglich[s*(groeszen[0]+1)];
exit;
end;
if spalte=dim then begin
if rand[dim+zeile]=-1 then
exit;
w:=0;
- for I:=0 to dim-1 do begin
+ for i:=0 to dim-1 do begin
{$IFDEF buchstaben}
w:=w*(groeszen[0]+2)+inhalt[zeile*dim+i]+1;
{$ENDIF}
@@ -513,7 +513,7 @@ begin
{$ENDIF}
end;
result:=
- AMoeglich[w*(groeszen[0]+1)+max(0,Rand[dim+zeile])] or
+ AMoeglich[w*(groeszen[0]+1)+max(0,rand[dim+zeile])] or
not AMoeglich[w*(groeszen[0]+1)];
exit;
end;
@@ -521,24 +521,24 @@ begin
if rand[2*dim+spalte]=-1 then
exit;
s:=0;
- for I:=0 to dim-1 do begin
+ for i:=0 to dim-1 do begin
{$IFDEF buchstaben}
- S:=S*(groeszen[0]+2)+inhalt[I*dim+Spalte]+1;
+ s:=s*(groeszen[0]+2)+inhalt[i*dim+spalte]+1;
{$ENDIF}
{$IFDEF hochhaus}
- S:=S*(dim+1)+max(0,inhalt[I*dim+Spalte]);
+ s:=s*(dim+1)+max(0,inhalt[i*dim+spalte]);
{$ENDIF}
end;
result:=
- AMoeglich[S*(groeszen[0]+1)+max(0,Rand[2*dim+Spalte])] or
- not EMoeglich[S*(groeszen[0]+1)];
+ AMoeglich[s*(groeszen[0]+1)+max(0,rand[2*dim+spalte])] or
+ not EMoeglich[s*(groeszen[0]+1)];
exit;
end;
if spalte=-1 then begin
if rand[3*dim+zeile]=-1 then
exit;
w:=0;
- for I:=0 to dim-1 do begin
+ for i:=0 to dim-1 do begin
{$IFDEF buchstaben}
w:=w*(groeszen[0]+2)+inhalt[zeile*dim+i]+1;
{$ENDIF}
@@ -547,7 +547,7 @@ begin
{$ENDIF}
end;
result:=
- EMoeglich[w*(groeszen[0]+1)+max(0,Rand[3*dim+zeile])] or
+ EMoeglich[w*(groeszen[0]+1)+max(0,rand[3*dim+zeile])] or
not EMoeglich[w*(groeszen[0]+1)];
exit;
end;
@@ -578,24 +578,24 @@ begin
{$IFDEF buchstaben}
if inhalt[i+dim*j]=0 then
continue;
- Rand[I]:=inhalt[I+dim*J];
+ rand[i]:=inhalt[i+dim*j];
break;
{$ENDIF}
{$IFDEF hochhaus}
- if inhalt[I+dim*J]>H then begin
- H:=inhalt[I+dim*J];
- inc(Z);
+ if inhalt[i+dim*j]>h then begin
+ h:=inhalt[i+dim*j];
+ inc(z);
end;
{$ENDIF}
end;
{$IFDEF hochhaus}
- Rand[I]:=Z;
+ rand[i]:=z;
- H:=0;
- Z:=0;
+ h:=0;
+ z:=0;
{$ENDIF}
- For J:=dim-1 downto 0 do begin
- if inhalt[I+dim*J]=-1 then begin
+ for j:=dim-1 downto 0 do begin
+ if inhalt[i+dim*j]=-1 then begin
{$IFDEF hochhaus}
z:=0;
{$ENDIF}
@@ -604,69 +604,70 @@ begin
{$IFDEF buchstaben}
if inhalt[i+dim*j]=0 then
continue;
- Rand[2*dim+I]:=inhalt[I+dim*J];
+ rand[2*dim+i]:=inhalt[i+dim*j];
break;
{$ENDIF}
{$IFDEF hochhaus}
- if inhalt[I+dim*J]>H then begin
- H:=inhalt[I+dim*J];
- inc(Z);
+ if inhalt[i+dim*j]>h then begin
+ h:=inhalt[i+dim*j];
+ inc(z);
end;
{$ENDIF}
end;
{$IFDEF hochhaus}
- Rand[2*dim+I]:=Z;
+ rand[2*dim+i]:=z;
- H:=0;
- Z:=0;
+ h:=0;
+ z:=0;
{$ENDIF}
- For J:=dim-1 downto 0 do begin
- if inhalt[J+dim*I]=-1 then begin
+ for j:=dim-1 downto 0 do begin
+ if inhalt[j+dim*i]=-1 then begin
{$IFDEF hochhaus}
z:=0;
{$ENDIF}
break;
end;
{$IFDEF buchstaben}
- if inhalt[J+dim*I]=0 then
+ if inhalt[j+dim*i]=0 then
continue;
- Rand[dim+I]:=inhalt[J+dim*I];
+ rand[dim+i]:=inhalt[j+dim*i];
break;
{$ENDIF}
{$IFDEF hochhaus}
- if inhalt[J+dim*I]>H then begin
- H:=inhalt[J+dim*I];
- inc(Z);
+ if inhalt[j+dim*i]>h then begin
+ h:=inhalt[j+dim*i];
+ inc(z);
end;
{$ENDIF}
end;
{$IFDEF hochhaus}
- Rand[dim+I]:=Z;
+ rand[dim+i]:=z;
- H:=0;
- Z:=0;
+ h:=0;
+ z:=0;
{$ENDIF}
- For J:=0 to dim-1 do begin
- if inhalt[J+dim*I]=-1 then begin
+ for j:=0 to dim-1 do begin
+ if inhalt[j+dim*i]=-1 then begin
{$IFDEF hochhaus}
- Z:=0;
+ z:=0;
{$ENDIF}
break;
end;
{$IFDEF buchstaben}
- if inhalt[J+dim*I]=0 then continue;
- Rand[3*dim+I]:=inhalt[J+dim*I];
+ if inhalt[j+dim*i]=0 then
+ continue;
+ rand[3*dim+i]:=inhalt[j+dim*i];
break;
{$ENDIF}
{$IFDEF hochhaus}
- if inhalt[J+dim*I]>H then begin
- H:=inhalt[J+dim*I];
- inc(Z);
+ if inhalt[j+dim*i]>h then begin
+ h:=inhalt[j+dim*i];
+ inc(z);
end;
{$ENDIF}
end;
{$IFDEF hochhaus}
- Rand[3*dim+I]:=Z;
+ rand[3*dim+i]:=z;
{$ENDIF}
end;
end;
@@ -675,7 +676,7 @@ end;
{$IFDEF relativeInhaltsAenderung}
// procedure tHochhausRaetsel.relativeInhaltsAenderung(diff: longint);
begin
- if (cursorPosition<0) or (cursorPosition>=dim*dim) or startfeld[cursorPosition] then
+ if (cursorPosition<0) or (cursorPosition>=dim*dim) or startFeld[cursorPosition] then
exit;
alsZugSpeichern;
{$IFDEF hochhaus}
@@ -694,7 +695,7 @@ end;
{$IFDEF absoluteInhaltsAenderung}
// function tHochhausRaetsel.absoluteInhaltsAenderung(key: word): boolean;
begin
- if (cursorPosition<0) or (cursorPosition>=dim*dim) or startfeld[cursorPosition] then begin
+ if (cursorPosition<0) or (cursorPosition>=dim*dim) or startFeld[cursorPosition] then begin
result:=false;
exit;
end;
@@ -738,29 +739,29 @@ var
perm: tLongintArray;
begin
result:=false;
- setlength(perm,0);
+ setLength(perm,0);
for p:=lPos+1 to dim*dim-1 do
- if inhalt[P]=-1 then begin
+ if inhalt[p]=-1 then begin
{$IFDEF buchstaben}
perm:=permutation(groeszen[0]+1);
{$ENDIF}
{$IFDEF hochhaus}
perm:=permutation(dim);
{$ENDIF}
- for I:=0 to dim-1 do begin
+ for i:=0 to dim-1 do begin
{$IFDEF buchstaben}
- inhalt[P]:=Perm[I];
+ inhalt[p]:=perm[i];
{$ENDIF}
{$IFDEF hochhaus}
- inhalt[P]:=Perm[I]+1;
+ inhalt[p]:=perm[i]+1;
{$ENDIF}
- if passt(P mod dim,P div dim) then
- if loesen(P) then begin
+ if passt(p mod dim,p div dim) then
+ if loesen(p) then begin
result:=true;
exit;
end;
end;
- inhalt[P]:=-1;
+ inhalt[p]:=-1;
exit;
end;
result:=true;
@@ -773,21 +774,21 @@ var
i,p: integer;
begin
result:=0;
- for P:=lPos+1 to dim*dim-1 do
- if inhalt[P]=-1 then begin
+ for p:=lPos+1 to dim*dim-1 do
+ if inhalt[p]=-1 then begin
for
- {$IFDEF hochhaus} I:=1 {$ENDIF}
- {$IFDEF buchstaben}I:=0 {$ENDIF}
+ {$IFDEF hochhaus} i:=1 {$ENDIF}
+ {$IFDEF buchstaben}i:=0 {$ENDIF}
to groeszen[0] do begin
- inhalt[P]:=I;
- if passt(P mod dim,P div dim) then
- result:=result+Anzloesungen(P);
+ inhalt[p]:=i;
+ if passt(p mod dim,p div dim) then
+ result:=result+anzLoesungen(p);
if result>=2 then begin
- inhalt[P]:=-1;
+ inhalt[p]:=-1;
exit;
end;
end;
- inhalt[P]:=-1;
+ inhalt[p]:=-1;
exit;
end;
result:=1;