1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153:
| unit Uhaengemaennchen;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;
type TForm1 = class(TForm) Image1: TImage; EBuchstabe: TEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; function buchstabeVorhanden (was : string; buchstabe : char) : boolean; function gewonnen : boolean; procedure ratewortAnzeigen (wort : string); procedure ratewortErzeugen (was : string); procedure BildZeichnen (was : integer); procedure FormActivate(Sender: TObject); procedure FormKeyPress(Sender: TObject; var Key: Char); procedure TForm1.BuchstabeEinsetzen (var Ratewort:string; Suchwort:string; buchstabe : char); procedure FormCreate(Sender : TObject); private public end;
var Form1: TForm1; was, Zaehler, i : Integer; buchstabe : char; Suchwort, Ratewort : string; WortVollstaendig, zeichenDa : boolean; implementation
{$R *.dfm} procedure TForm1.BildZeichnen; begin with Image1.Canvas do begin case was of 1: begin arc(50,250,150,350,150,275,50,275); end; 2: begin MoveTo(100,250); LineTo(100,100); end; 3: begin MoveTo(100,100); LineTo(200,100); end; 4: begin MoveTo(200,100); LineTo(200,130); end; 5: begin ellipse(190,130,210,150); end; 6: begin MoveTo(200,150); LineTo(200,190); end; 7: begin MoveTo(200,160); LineTo(220,160); end; 8: begin MoveTo(220,160); LineTo(240,140); end; 9: begin MoveTo(200,160); LineTo(180,160); end; 10: begin MoveTo(180,160); LineTo(160,140); end; 11: begin MoveTo(200,190); LineTo(220,210); end; 12: begin MoveTo(220,210); LineTo(220,230); end; 13: begin MoveTo(200,190); LineTo(180,210); end; 14: begin MoveTo(180,210); LineTo(180,230); end; end; end; end;
procedure TForm1.FormActivate(Sender: TObject); begin was :=0; end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); var i : integer; begin if (not WortVollstaendig) then begin key:= upcase(key); if (BuchstabeVorhanden (key)) then begin buchstabeEinsetzen (key); end else begin Bildzeichnen (was); inc (was); end; end;
end;
procedure TForm1.ratewortAnzeigen(wort:string); var i : integer; begin end;
procedure TForm1.ratewortErzeugen(Was:string); var i : integer; Suchwort : string; begin Suchwort:='anrufbeantworter'; for i=1 to length(Suchwort) do Suchwort[i]:=upcase(Suchwort[i]); if (Ratewort[i] = '_') then Ratewort [i]:=' '; Label3.caption:=Label3.caption+'_'; end;
function TForm1.buchstabevorhanden(Was:String;Buchstabe:char):boolean; var i : integer; begin buchstabeVorhanden := false; for i:=1 to length (Suchwort) do begin if (Suchwort [i]=buchstabe) then begin buchstabeVorhanden := true; end; end; end;
function TForm1.gewonnen : boolean; var i :integer; begin gewonnen := true; for i:=1 to length (Suchwort) do begin if (Ratewort [i] <> Label3.caption [i*2-1]) then gewonnen:=false; end; end; procedure TForm1.BuchstabeEinsetzen (var Ratewort:string; Suchwort:string; buchstabe : char); var i : integer; begin for i:=1 to length(Suchwort) do if Suchwort [i]=buchstabe then Ratewort[i]:=Buchstabe; end;
function Ausgabe(was:string):string; var i : integer; tmp : String; begin tmp:=' '; for i:=1 to length(was) do tmp:=tmp + was[i] + ' '; Label3.caption:=tmp; end; end. |