summaryrefslogtreecommitdiff
path: root/raetselunit.pas
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-30 21:29:21 +0200
committerErich Eckner <git@eckner.net>2018-09-30 21:29:21 +0200
commitd81c2373be6697e2ebcfd082831115c4f182b6a0 (patch)
tree87f7c58fa15a5057bccbf2ffd206016236faa491 /raetselunit.pas
parentaba523b2d0815b4d900b387044abda19995c0973 (diff)
downloadRaetsel-d81c2373be6697e2ebcfd082831115c4f182b6a0.tar.xz
buchstabenunit.pas & hochhausunit.pas neu
Diffstat (limited to 'raetselunit.pas')
-rw-r--r--raetselunit.pas160
1 files changed, 2 insertions, 158 deletions
diff --git a/raetselunit.pas b/raetselunit.pas
index a5c63d5..2d60340 100644
--- a/raetselunit.pas
+++ b/raetselunit.pas
@@ -43,11 +43,11 @@ type
procedure erzeugeOnClick(sender: tObject);
procedure loeschen; dynamic; abstract;
function loesen(inhaltBehalten: boolean): longint; dynamic; abstract;
- function _loesen(lm: tFelderLoesMeta): longint; dynamic; abstract;
procedure leeren; dynamic; abstract;
public
constructor create(aOwner: tForm);
destructor destroy; override;
+ function _loesen(lm: tFelderLoesMeta): longint; dynamic; abstract;
procedure zeichnen; dynamic; abstract;
end;
@@ -78,32 +78,9 @@ type
procedure zeichnen; override;
end;
- tBuchstabenRaetsel = class(tFelderRaetsel)
- private
- procedure relativeInhaltsAenderung(diff: longint); override;
- function absoluteInhaltsAenderung(key: word): boolean; override;
- function _loesen(lm: tFelderLoesMeta): longint; override;
- public
- constructor create(aOwner: tForm);
- destructor destroy; override;
- end;
-
- tHochhausRaetsel = class(tFelderRaetsel)
- private
- procedure relativeInhaltsAenderung(diff: longint); override;
- function absoluteInhaltsAenderung(key: word): boolean; override;
- function _loesen(lm: tFelderLoesMeta): longint; override;
- public
- constructor create(aOwner: tForm);
- destructor destroy; override;
- end;
-
const
spacing = 2;
-function buchstabenAlphabetFunktion(i: longint): string;
-function zahlenAlphabetFunktion(i: longint): string;
-
implementation
uses
@@ -386,6 +363,7 @@ begin
lm.aktualisiereRand(p[i]);
end;
end;
+ lm.free;
end;
procedure tFelderRaetsel.aktualisiereZeichenflaechenGroesze;
@@ -473,139 +451,5 @@ begin
schreibeZentriert(i mod dim,i div dim,inhalt[i]);
end;
-// tBuchstabenRaetsel **********************************************************
-
-constructor tBuchstabenRaetsel.create(aOwner: tForm);
-begin
- inherited create(aOwner,2,@buchstabenAlphabetFunktion);
- spinEdits[1].showHint:=true;
- spinEdits[1].hint:='Anzahl Buchstaben';
- spinEdits[1].value:=5;
- spinEdits[2].showHint:=true;
- spinEdits[2].hint:='Anzahl Leerfelder';
- spinEdits[2].value:=1;
- aktualisiereGroesze;
-end;
-
-destructor tBuchstabenRaetsel.destroy;
-begin
- inherited destroy;
-end;
-
-procedure tBuchstabenRaetsel.relativeInhaltsAenderung(diff: longint);
-begin
- if (cursorPosition<0) or (cursorPosition>=dim*dim) then exit;
- inhalt[cursorPosition]:=min(max(-1,inhalt[cursorPosition]+diff),groeszen[0]);
-end;
-
-function tBuchstabenRaetsel.absoluteInhaltsAenderung(key: word): boolean;
-begin
- result:=true;
- if (key>=ord('A')) and (key<=min(ord('A')+groeszen[0]-1,ord('Z'))) then begin
- inhalt[cursorPosition]:=key-ord('A')+1;
- exit;
- end;
- if (key=ord(' ')) or (key=46) or (key=8) then begin
- inhalt[cursorPosition]:=-1;
- exit;
- end;
- if (key=189) then begin
- inhalt[cursorPosition]:=0;
- exit;
- end;
- result:=false;
-end;
-
-function tBuchstabenRaetsel._loesen(lm: tFelderLoesMeta): longint;
-begin
- if not lm.fwd then begin
- result:=1;
- exit;
- end;
- if inhalt[lm.posi]>=0 then begin
- result:=_loesen(lm);
- exit;
- end;
-
- result:=0;
- //for
-
- if not lm.inhaltBehalten then begin
- inhalt[lm.posi]:=-1;
- lm.aktualisiereInhalt(lm.posi);
- end;
-end;
-
-// tHochhausRaetsel ************************************************************
-
-constructor tHochhausRaetsel.create(aOwner: tForm);
-begin
- inherited create(aOwner,1,@zahlenAlphabetFunktion);
- spinEdits[1].showHint:=true;
- spinEdits[1].hint:='Anzahl Spalten';
- spinEdits[1].value:=5;
- aktualisiereGroesze;
-end;
-
-destructor tHochhausRaetsel.destroy;
-begin
- inherited destroy;
-end;
-
-procedure tHochhausRaetsel.relativeInhaltsAenderung(diff: longint);
-begin
- if (cursorPosition<0) or (cursorPosition>=dim*dim) then exit;
- if inhalt[cursorPosition]=-1 then inhalt[cursorPosition]:=0;
- inhalt[cursorPosition]:=min(max(0,inhalt[cursorPosition]+diff),groeszen[0]);
- if inhalt[cursorPosition]=0 then inhalt[cursorPosition]:=-1;
-end;
-
-function tHochhausRaetsel.absoluteInhaltsAenderung(key: word): boolean;
-begin
- result:=true;
- if (key>=ord('1')) and (key<=min(ord('1')+groeszen[0]-1,ord('9'))) then begin
- inhalt[cursorPosition]:=key-ord('1')+1;
- exit;
- end;
- if (key=ord(' ')) or (key=46) or (key=8) then begin
- inhalt[cursorPosition]:=-1;
- exit;
- end;
- result:=false;
-end;
-
-function tHochhausRaetsel._loesen(lm: tFelderLoesMeta): longint;
-begin
-
-end;
-
-// allgemeine Funktionen *******************************************************
-
-function buchstabenAlphabetFunktion(i: longint): string;
-begin
- if i<0 then
- result:=''
- else if i=0 then
- result:='-'
- else begin
- result:='';
- while i>0 do begin
- dec(i);
- result:=char(ord('A')+(i mod 26))+result;
- i:=i div 26;
- end;
- end;
-end;
-
-function zahlenAlphabetFunktion(i: longint): string;
-begin
- if i<0 then
- result:=''
- else if i=0 then
- result:='-'
- else
- result:=inttostr(i);
-end;
-
end.