summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--raetsel.lps148
-rw-r--r--raetselunit.inc164
-rw-r--r--raetselunit.pas13
3 files changed, 168 insertions, 157 deletions
diff --git a/raetsel.lps b/raetsel.lps
index 81ab4d0..67fe025 100644
--- a/raetsel.lps
+++ b/raetsel.lps
@@ -9,7 +9,7 @@
<IsPartOfProject Value="True"/>
<EditorIndex Value="2"/>
<CursorPos X="35" Y="10"/>
- <UsageCount Value="44"/>
+ <UsageCount Value="49"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@@ -19,8 +19,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="32"/>
- <CursorPos X="13" Y="68"/>
- <UsageCount Value="44"/>
+ <CursorPos Y="52"/>
+ <UsageCount Value="49"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@@ -33,18 +33,17 @@
<UnitName Value="Unit2"/>
<EditorIndex Value="4"/>
<CursorPos X="20" Y="12"/>
- <UsageCount Value="43"/>
+ <UsageCount Value="48"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit2>
<Unit3>
<Filename Value="raetselunit.pas"/>
<IsPartOfProject Value="True"/>
- <IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
- <TopLine Value="452"/>
- <CursorPos Y="487"/>
- <UsageCount Value="38"/>
+ <TopLine Value="108"/>
+ <CursorPos X="30" Y="127"/>
+ <UsageCount Value="43"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
@@ -63,19 +62,19 @@
<Filename Value="Unit1.pas"/>
<EditorIndex Value="-1"/>
<CursorPos X="3" Y="17"/>
- <UsageCount Value="9"/>
+ <UsageCount Value="8"/>
</Unit6>
<Unit7>
<Filename Value="RaetselFileUnit.pas"/>
<UnitName Value="raetselFileUnit"/>
<EditorIndex Value="-1"/>
- <UsageCount Value="9"/>
+ <UsageCount Value="8"/>
</Unit7>
<Unit8>
<Filename Value="raetselFileUnit.pas"/>
<EditorIndex Value="-1"/>
<CursorPos X="28" Y="11"/>
- <UsageCount Value="9"/>
+ <UsageCount Value="8"/>
</Unit8>
<Unit9>
<Filename Value="ori_Unit1.pas"/>
@@ -84,9 +83,9 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<EditorIndex Value="5"/>
- <TopLine Value="1043"/>
- <CursorPos Y="1082"/>
- <UsageCount Value="12"/>
+ <TopLine Value="1742"/>
+ <CursorPos X="24" Y="1985"/>
+ <UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
@@ -95,7 +94,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="1255"/>
<CursorPos X="3" Y="1277"/>
- <UsageCount Value="9"/>
+ <UsageCount Value="8"/>
</Unit10>
<Unit11>
<Filename Value="/usr/share/lazarus/lcl/dialogs.pp"/>
@@ -103,143 +102,164 @@
<EditorIndex Value="-1"/>
<TopLine Value="487"/>
<CursorPos X="10" Y="509"/>
- <UsageCount Value="10"/>
+ <UsageCount Value="9"/>
</Unit11>
<Unit12>
<Filename Value="../units/lowlevelunit.pas"/>
<EditorIndex Value="-1"/>
- <UsageCount Value="10"/>
+ <UsageCount Value="9"/>
</Unit12>
<Unit13>
<Filename Value="raetselunit.inc"/>
<IsPartOfProject Value="True"/>
+ <IsVisibleTab Value="True"/>
<EditorIndex Value="3"/>
- <CursorPos X="15" Y="13"/>
- <UsageCount Value="23"/>
+ <TopLine Value="397"/>
+ <CursorPos Y="417"/>
+ <UsageCount Value="28"/>
<Loaded Value="True"/>
</Unit13>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
- <Filename Value="ori_Unit1.pas"/>
- <Caret Line="1826" Column="16" TopLine="1794"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="414" TopLine="390"/>
</Position1>
<Position2>
- <Filename Value="ori_Unit1.pas"/>
- <Caret Line="112" Column="20" TopLine="94"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="415" TopLine="390"/>
</Position2>
<Position3>
- <Filename Value="ori_Unit1.pas"/>
- <Caret Line="568" Column="20" TopLine="535"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="414" TopLine="390"/>
</Position3>
<Position4>
- <Filename Value="ori_Unit1.pas"/>
- <Caret Line="890" Column="17" TopLine="857"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="415" TopLine="390"/>
</Position4>
<Position5>
<Filename Value="raetselunit.inc"/>
- <Caret Line="23"/>
+ <Caret Line="414" TopLine="390"/>
</Position5>
<Position6>
<Filename Value="raetselunit.inc"/>
- <Caret Line="442" Column="3" TopLine="415"/>
+ <Caret Line="415" TopLine="390"/>
</Position6>
<Position7>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="338" TopLine="316"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="414" TopLine="390"/>
</Position7>
<Position8>
<Filename Value="raetselunit.inc"/>
- <Caret Line="15"/>
+ <Caret Line="415" TopLine="390"/>
</Position8>
<Position9>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="39" Column="23" TopLine="34"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="414" TopLine="390"/>
</Position9>
<Position10>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="65" Column="23" TopLine="33"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="415" TopLine="390"/>
</Position10>
<Position11>
<Filename Value="raetselunit.inc"/>
- <Caret Line="30" Column="32"/>
+ <Caret Line="414" TopLine="390"/>
</Position11>
<Position12>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="220" Column="57" TopLine="203"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="415" TopLine="390"/>
</Position12>
<Position13>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="34" Column="31"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="414" TopLine="390"/>
</Position13>
<Position14>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="35" Column="20" TopLine="2"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="412" TopLine="390"/>
</Position14>
<Position15>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="370" Column="28" TopLine="338"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="413" TopLine="390"/>
</Position15>
<Position16>
<Filename Value="raetselunit.inc"/>
- <Caret Line="13" Column="15" TopLine="19"/>
+ <Caret Line="414" TopLine="390"/>
</Position16>
<Position17>
<Filename Value="raetselunit.inc"/>
- <Caret Line="439" Column="26" TopLine="417"/>
+ <Caret Line="415" TopLine="390"/>
</Position17>
<Position18>
<Filename Value="raetselunit.inc"/>
- <Caret Line="13" Column="15"/>
+ <Caret Line="414" TopLine="390"/>
</Position18>
<Position19>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="370" Column="28" TopLine="338"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="415" TopLine="390"/>
</Position19>
<Position20>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="468" TopLine="441"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="414" TopLine="390"/>
</Position20>
<Position21>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="488" Column="25" TopLine="451"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="415" TopLine="390"/>
</Position21>
<Position22>
<Filename Value="raetselunit.inc"/>
- <Caret Line="484" TopLine="445"/>
+ <Caret Line="414" TopLine="390"/>
</Position22>
<Position23>
<Filename Value="raetselunit.inc"/>
- <Caret Line="524" Column="55" TopLine="490"/>
+ <Caret Line="415" TopLine="390"/>
</Position23>
<Position24>
<Filename Value="raetselunit.inc"/>
- <Caret Line="449" Column="5" TopLine="430"/>
+ <Caret Line="414" TopLine="390"/>
</Position24>
<Position25>
<Filename Value="raetselunit.inc"/>
- <Caret Line="524" Column="49" TopLine="490"/>
+ <Caret Line="415" TopLine="390"/>
</Position25>
<Position26>
<Filename Value="raetselunit.inc"/>
- <Caret Line="488" Column="17" TopLine="469"/>
+ <Caret Line="414" TopLine="390"/>
</Position26>
<Position27>
<Filename Value="raetselunit.inc"/>
- <Caret Line="507" Column="13" TopLine="487"/>
+ <Caret Line="415" TopLine="390"/>
</Position27>
<Position28>
<Filename Value="raetselunit.inc"/>
- <Caret Line="452" Column="5" TopLine="439"/>
+ <Caret Line="414" TopLine="390"/>
</Position28>
<Position29>
<Filename Value="raetselunit.inc"/>
- <Caret Line="520" TopLine="482"/>
+ <Caret Line="408" TopLine="390"/>
</Position29>
<Position30>
- <Filename Value="raetselunit.pas"/>
- <Caret Line="487" Column="3" TopLine="452"/>
+ <Filename Value="raetselunit.inc"/>
+ <Caret Line="284" TopLine="264"/>
</Position30>
</JumpHistory>
</ProjectSession>
+ <Debugging>
+ <Watches Count="5">
+ <Item1>
+ <Expression Value="W"/>
+ </Item1>
+ <Item2>
+ <Expression Value="S"/>
+ </Item2>
+ <Item3>
+ <Expression Value="inhalt[Zeile*dim+I]"/>
+ </Item3>
+ <Item4>
+ <Expression Value="inhalt[I*dim+Spalte]"/>
+ </Item4>
+ <Item5>
+ <Expression Value="inhalt"/>
+ </Item5>
+ </Watches>
+ </Debugging>
</CONFIG>
diff --git a/raetselunit.inc b/raetselunit.inc
index 5d40b2d..6c796ce 100644
--- a/raetselunit.inc
+++ b/raetselunit.inc
@@ -13,16 +13,12 @@ type
function passtZumZeichnen(spalte,zeile: integer): boolean; override;
function passt(spalte,zeile: integer): boolean; override;
function geloest: boolean; override;
+ procedure gesamtRaenderErzeugen; override;
public
- {$IFDEF buchstaben}
- NBuchst,
- NLeer,
- {$ENDIF}
NSqrt: integer;
AMoeglich,EMoeglich: array of boolean;
constructor create(aOwner: tForm);
destructor destroy; override;
- procedure gesamtRaenderErzeugen;
// function Loesen(lPos: integer): boolean;
// procedure leeren;
// procedure RandErzeugen;
@@ -106,9 +102,9 @@ begin
KS:=(Spalte div dim)*dim;
for I:=0 to dim-1 do begin
{$IFDEF buchstaben}
- W:=W*(NBuchst+2)+inhalt[Zeile*dim+I]+1;
- S:=S*(NBuchst+2)+inhalt[I*dim+Spalte]+1;
- K:=K*(NBuchst+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)+inhalt[Zeile*dim+I];
@@ -118,11 +114,11 @@ begin
end;
result:=
{$IFDEF buchstaben}
- AMoeglich[K*(NBuchst+1)] and
- EMoeglich[S*(NBuchst+1)+Rand[Spalte]] and
- AMoeglich[W*(NBuchst+1)+Rand[dim+Zeile]] and
- AMoeglich[S*(NBuchst+1)+Rand[2*dim+Spalte]] and
- EMoeglich[W*(NBuchst+1)+Rand[3*dim+Zeile]];
+ AMoeglich[K*(groeszen[0]+1)] and
+ EMoeglich[S*(groeszen[0]+1)+Rand[Spalte]] and
+ AMoeglich[W*(groeszen[0]+1)+Rand[dim+Zeile]] and
+ AMoeglich[S*(groeszen[0]+1)+Rand[2*dim+Spalte]] and
+ EMoeglich[W*(groeszen[0]+1)+Rand[3*dim+Zeile]];
{$ENDIF}
{$IFDEF hochhaus}
AMoeglich[K*(dim+1)] and
@@ -135,8 +131,8 @@ begin
else begin
for I:=0 to dim-1 do begin
{$IFDEF buchstaben}
- W:=W*(NBuchst+2)+inhalt[Zeile*dim+I]+1;
- S:=S*(NBuchst+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)+inhalt[Zeile*dim+I];
@@ -145,10 +141,10 @@ begin
end;
result:=
{$IFDEF buchstaben}
- EMoeglich[S*(NBuchst+1)+Rand[Spalte]] and
- AMoeglich[W*(NBuchst+1)+Rand[dim+Zeile]] and
- AMoeglich[S*(NBuchst+1)+Rand[2*dim+Spalte]] and
- EMoeglich[W*(NBuchst+1)+Rand[3*dim+Zeile]];
+ EMoeglich[S*(groeszen[0]+1)+Rand[Spalte]] and
+ AMoeglich[W*(groeszen[0]+1)+Rand[dim+Zeile]] and
+ AMoeglich[S*(groeszen[0]+1)+Rand[2*dim+Spalte]] and
+ EMoeglich[W*(groeszen[0]+1)+Rand[3*dim+Zeile]];
{$ENDIF}
{$IFDEF hochhaus}
EMoeglich[S*(dim+1)+Rand[Spalte]] and
@@ -162,8 +158,8 @@ begin
W:=0;
{$IFDEF buchstaben}
for I:=0 to dim-1 do
- W:=W*(NBuchst+2)+inhalt[I*(dim+1)]+1;
- Result:=Result and AMoeglich[W*(NBuchst+1)];
+ 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
@@ -175,8 +171,8 @@ begin
W:=0;
{$IFDEF buchstaben}
for I:=0 to dim-1 do
- W:=W*(NBuchst+2)+inhalt[(I+1)*(dim-1)]+1;
- Result:=Result and AMoeglich[W*(NBuchst+1)];
+ 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
@@ -218,8 +214,9 @@ var
B: Boolean;
Basis,Faktor: Integer;
Schritt: Longint;
- dat: File of Cardinal;
- lw1,lw2,L: Cardinal;
+ dat: file;
+ buff: array of byte;
+ lw: Cardinal;
const dat_name =
{$IFDEF buchstaben}
@@ -262,8 +259,8 @@ end;
begin
{$IFDEF buchstaben}
- Basis:=NBuchst+2;
- Faktor:=NBuchst+1;
+ Basis:=groeszen[0]+2;
+ Faktor:=groeszen[0]+1;
{$ENDIF}
{$IFDEF hochhaus}
Basis:=dim+1;
@@ -277,36 +274,25 @@ begin
if fileexists(extractfilepath(application.exename)+dat_name) then begin
assignfile(dat,extractfilepath(application.exename)+dat_name);
- reset(dat);
+ reset(dat,1);
while not eof(dat) do begin
- read(dat,lw1);
- if lw1=AK then begin
+ blockread(dat,lw,sizeof(lw));
+ if lw=AK then begin
Setlength(AMoeglich,AK);
Setlength(EMoeglich,AK);
- for L:=0 to length(AMoeglich)-1 do begin
- if L mod 32 = 0 then
- if not eof(dat) then
- read(dat,lw2)
- else begin
- messageDlg('Frühzeitiges Dateiende!',mterror,[mbOk],0);
- exit;
- end;
- AMoeglich[L]:=odd(lw2 shr (L mod 32));
- end;
- For L:=0 to length(EMoeglich)-1 do begin
- if L mod 32 = 0 then
- if not eof(dat) then
- read(dat,lw2)
- else begin
- messageDlg('Frühzeitiges Dateiende!',mterror,[mbOk],0);
- exit;
- end;
- EMoeglich[L]:=odd(lw2 shr (L mod 32));
- end;
+ 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));
+ 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);
exit;
end
else
- Seek(dat,Filepos(dat)+((lw1-1) div 32 +1)*2);
+ seek(dat,filepos(dat)+2*((lw + 7) div 8));
end;
closefile(dat);
end;
@@ -315,6 +301,7 @@ begin
Progressbar1.Min:=0;
Progressbar1.Max:=1000;
Progressbar1.Position:=0;
+ Application.ProcessMessages;
Setlength(AMoeglich,AK);
Setlength(EMoeglich,AK);
@@ -326,12 +313,14 @@ begin
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
- Progressbar1.StepIt;
+ if AK mod Schritt = 0 then begin
+ progressbar1.stepIt;
+ application.processMessages;
+ end;
Nums:=calcNums(AK);
B:=true;
{$IFDEF buchstaben}
- Nullen:=NLeer;
+ Nullen:=groeszen[1];
For I:=0 to length(Nums)-1 do
begin
B:=B and (Nums[I]<>0);
@@ -381,8 +370,10 @@ begin
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
- Progressbar1.StepIt;
+ if AK mod Schritt = 0 then begin
+ progressbar1.stepIt;
+ application.processMessages;
+ end;
Nums:=calcNums(AK);
J:=Nullen;
For I:=0 to dim-1 do
@@ -408,30 +399,27 @@ begin
Progressbar1.Visible:=False;
assignfile(dat,extractfilepath(application.exename)+dat_name);
- if Fileexists(extractfilepath(application.exename)+dat_name) then begin
- reset(dat);
- Seek(dat,Filesize(dat));
+ if fileexists(extractfilepath(application.exename)+dat_name) then begin
+ reset(dat,1);
+ seek(dat,filesize(dat));
end
else
- Rewrite(dat);
-
- lw1:=length(AMoeglich);
- write(dat,lw1);
- lw1:=0;
- For I:=0 to length(AMoeglich)-1 do begin
- lw1:=lw1 or (Byte(AMoeglich[I]) shl (I mod 32));
- if ((I mod 32) = 31) or (I = length(AMoeglich)-1) then begin
- write(dat,lw1);
- lw1:=0;
- end;
+ rewrite(dat,1);
+ lw:=length(AMoeglich);
+ 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
+ buff[i]:=buff[i] or (byte(AMoeglich[8*i+j]) shl j);
end;
- For I:=0 to length(EMoeglich)-1 do begin
- lw1:=lw1 or (Byte(EMoeglich[I]) shl (I mod 32));
- if ((I mod 32) = 31) or (I = length(EMoeglich)-1) then begin
- write(dat,lw1);
- lw1:=0;
- end;
+ blockWrite(dat,buff[0],length(buff));
+ for i:=0 to length(buff)-1 do begin
+ buff[i]:=0;
+ for j:=0 to min(7,length(EMoeglich)-8*i-1) do
+ buff[i]:=buff[i] or (byte(EMoeglich[8*i+j]) shl j);
end;
+ blockWrite(dat,buff[0],length(buff));
closefile(dat);
end;
{$ENDIF}
@@ -442,21 +430,21 @@ var
I,KS,KZ: Integer;
W,S: Longint;
begin
+ result:=false;
{$IFDEF buchstaben}
- if inhalt[Zeile*dim+Spalte]=-1 then begin
+ if inhalt[Zeile*dim+Spalte]=-1 then
+ exit;
{$ENDIF}
{$IFDEF hochhaus}
- if inhalt[Zeile*dim+Spalte]=0 then begin
- {$ENDIF}
- result:=false;
+ if inhalt[Zeile*dim+Spalte]=0 then
exit;
- end;
+ {$ENDIF}
W:=0;
S:=0;
for I:=0 to dim-1 do begin
{$IFDEF buchstaben}
- W:=W*(NBuchst+2)+inhalt[Zeile*dim+I]+1;
- S:=S*(NBuchst+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)+inhalt[Zeile*dim+I];
@@ -465,10 +453,10 @@ begin
end;
Result:=
{$IFDEF buchstaben}
- (EMoeglich[S*(NBuchst+1)+Rand[Spalte]] or not EMoeglich[S*(NBuchst+1)]) and
- (AMoeglich[W*(NBuchst+1)+Rand[dim+Zeile]] or not AMoeglich[W*(NBuchst+1)]) and
- (AMoeglich[S*(NBuchst+1)+Rand[2*dim+Spalte]] or not AMoeglich[S*(NBuchst+1)]) and
- (EMoeglich[W*(NBuchst+1)+Rand[3*dim+Zeile]] or not EMoeglich[W*(NBuchst+1)]);
+ (EMoeglich[S*(groeszen[0]+1)+Rand[Spalte]] or not EMoeglich[S*(groeszen[0]+1)]) and
+ (AMoeglich[W*(groeszen[0]+1)+Rand[dim+Zeile]] or not AMoeglich[W*(groeszen[0]+1)]) and
+ (AMoeglich[S*(groeszen[0]+1)+Rand[2*dim+Spalte]] or not AMoeglich[S*(groeszen[0]+1)]) and
+ (EMoeglich[W*(groeszen[0]+1)+Rand[3*dim+Zeile]] or not EMoeglich[W*(groeszen[0]+1)]);
{$ENDIF}
{$IFDEF hochhaus}
(EMoeglich[S*(dim+1)+Rand[Spalte]] or not EMoeglich[S*(dim+1)]) and
@@ -478,7 +466,7 @@ begin
{$ENDIF}
{$IFDEF buchstaben}
if inhalt[Zeile*dim+Spalte]=0 then
- W:=NLeer
+ W:=groeszen[1]
else
{$ENDIF}
W:=1;
diff --git a/raetselunit.pas b/raetselunit.pas
index b0cea36..6c77ce6 100644
--- a/raetselunit.pas
+++ b/raetselunit.pas
@@ -18,10 +18,11 @@ type
tRaetsel = class
private
- besitzer: tForm;
- zeichenflaeche: tImage;
- erzeugeBtn: tButtonWithArrowKeys;
- progressbar1: tProgressBar;
+ besitzer: tForm;
+ farbWahlFlaeche,
+ zeichenflaeche: tImage;
+ erzeugeBtn: tButtonWithArrowKeys;
+ progressbar1: tProgressBar;
function besitzerHoehe: longint; dynamic;
function besitzerBreite: longint; dynamic;
procedure zeichenFlaecheNeuKreieren;
@@ -60,6 +61,7 @@ type
procedure schreibeZentriert(x,y,i: longint);
procedure relativeInhaltsAenderung(diff: longint); dynamic; abstract;
function absoluteInhaltsAenderung(key: word): boolean; dynamic; abstract;
+ procedure gesamtRaenderErzeugen; dynamic; abstract;
public
constructor create(aOwner: tForm; anzInhTypen: longint; alphabetFunktion: tAlphabetFunktion);
destructor destroy; override;
@@ -285,6 +287,7 @@ begin
setlength(rand,4*(dim+1));
loeschen;
cursorPosition:=0;
+ gesamtRaenderErzeugen;
aktualisiereZeichenflaechenGroesze;
end;
@@ -367,7 +370,7 @@ begin
s:=uebersetze(i);
with zeichenflaeche.canvas do begin
brush.color:=$FFFFFF - $181818*byte(diagonalenCB.checked and ((x=y) or (x+y=dim+1)));
- if not passtZumZeichnen(x,y) then
+ if (x>=0) and (y>=0) and (x<dim) and (y<dim) and not passtZumZeichnen(x,y) then
font.color:=$0000FF
else if geloest then
font.color:=$007F00