commit bc42f5755ebff967ebdc6dbf37a8de1461476258 Author: Steffen Vogel Date: Tue Aug 17 01:23:08 2010 +0200 initial import diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f16baa8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.settings +.cproject +.project +.classpath + diff --git a/BadResult.wav b/BadResult.wav new file mode 100755 index 0000000..e5c505e Binary files /dev/null and b/BadResult.wav differ diff --git a/Bilder/image002.bmp b/Bilder/image002.bmp new file mode 100755 index 0000000..54ae9c7 Binary files /dev/null and b/Bilder/image002.bmp differ diff --git a/Bilder/image004.bmp b/Bilder/image004.bmp new file mode 100755 index 0000000..96f715c Binary files /dev/null and b/Bilder/image004.bmp differ diff --git a/Bilder/image006.bmp b/Bilder/image006.bmp new file mode 100755 index 0000000..019d51a Binary files /dev/null and b/Bilder/image006.bmp differ diff --git a/Bilder/image008.bmp b/Bilder/image008.bmp new file mode 100755 index 0000000..eca2615 Binary files /dev/null and b/Bilder/image008.bmp differ diff --git a/Bilder/image010.bmp b/Bilder/image010.bmp new file mode 100755 index 0000000..4f49a52 Binary files /dev/null and b/Bilder/image010.bmp differ diff --git a/Bilder/image012.bmp b/Bilder/image012.bmp new file mode 100755 index 0000000..745bdc4 Binary files /dev/null and b/Bilder/image012.bmp differ diff --git a/Bilder/image014.bmp b/Bilder/image014.bmp new file mode 100755 index 0000000..6fed6e6 Binary files /dev/null and b/Bilder/image014.bmp differ diff --git a/GoodResult.wav b/GoodResult.wav new file mode 100755 index 0000000..8d1dedd Binary files /dev/null and b/GoodResult.wav differ diff --git a/Potenz.GID b/Potenz.GID new file mode 100755 index 0000000..55ecf1b Binary files /dev/null and b/Potenz.GID differ diff --git a/Potenz.aip b/Potenz.aip new file mode 100755 index 0000000..33d0d81 --- /dev/null +++ b/Potenz.aip @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Potenz.cfg b/Potenz.cfg new file mode 100755 index 0000000..fb15674 --- /dev/null +++ b/Potenz.cfg @@ -0,0 +1,34 @@ +-$A+ +-$B- +-$C+ +-$D+ +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J+ +-$K- +-$L+ +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$YD +-$Z1 +-cg +-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +-H+ +-W+ +-M +-$M16384,1048576 +-K$00400000 +-LNc:\programme\borland\delphi4\Lib diff --git a/Potenz.cnt b/Potenz.cnt new file mode 100755 index 0000000..84589ef --- /dev/null +++ b/Potenz.cnt @@ -0,0 +1,44 @@ +:Base potenz.hlp +1 Willkommen!=willkommen>Main +1 Funktionsübersicht=funktionsübersicht>Main +1 Lizenz=lizenz>Main +1 Bedienung +2 Menü +3 Datei +4 Neue Übung starten=neueübungstarten>Main +4 Auswerten=auswerten>Main +4 Beenden=beenden>Main +3 Optionen +4 Negative Exponenten=negativeexponenten>Main +4 Zahlenbereich=zahlenbereich>Main +4 Aufgaben=aufgaben>Main +4 Ganzzahlige Ergebnisse=ganzzahligeergebnisse>Main +4 Sounds=sounds>Main +4 Zeit anzeigen=zeitanzeigen>Main +3 ? +4 Internet Ranking=internetranking>Main +4 Hilfe=hilfe>Main +4 Über=über>Main +2 Buttons +3 Hauptfenster +4 Überprüfen=überprüfen>Main +4 Weiter=weiter>Main +4 Rechner=rechner>Main +3 Zusammenfassung +4 Ergebnisse übertragen=ergebnisseübertragen>Main +4 Schließen=schließen>Main +3 Über Dialog +4 Schließen=about_schließen>Main +4 GPL=gpl>Main +2 Eingabefelder +3 Basis=basis>Main +3 Exponent=exponent>Main +2 Tastatur=tastatur>Main +1 Funktionen +2 Internet Ranking=funktion:internetranking>Main +2 Soundausgabe=soundausgabe>Main +1 Potenzgesetze +2 gleiche Basis=gleichebasis>Main +2 gleicher Exponent=gleicherexponent>Main +2 Potenz einer Potenz=potenzeinerpotenz>Main + diff --git a/Potenz.dof b/Potenz.dof new file mode 100755 index 0000000..c98314c --- /dev/null +++ b/Potenz.dof @@ -0,0 +1,78 @@ +[Compiler] +A=1 +B=0 +C=1 +D=1 +E=0 +F=0 +G=1 +H=1 +I=1 +J=1 +K=0 +L=1 +M=0 +N=1 +O=1 +P=1 +Q=0 +R=0 +S=0 +T=0 +U=0 +V=1 +W=0 +X=1 +Y=1 +Z=1 +ShowHints=1 +ShowWarnings=1 +UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +[Linker] +MapFile=0 +OutputObjs=0 +ConsoleApp=1 +DebugInfo=0 +RemoteSymbols=0 +MinStackSize=16384 +MaxStackSize=1048576 +ImageBase=4194304 +ExeDescription=Potenzübungsprogramm +[Directories] +OutputDir= +UnitOutputDir= +PackageDLLOutputDir= +PackageDCPOutputDir= +SearchPath= +Packages=Vcl40;Vclx40;Vcldb40;vcldbx40;VclSmp40;Qrpt40 +Conditionals= +DebugSourceDirs= +UsePackages=0 +[Parameters] +RunParams= +HostApplication= +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1031 +CodePage=1252 +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= diff --git a/Potenz.dpr b/Potenz.dpr new file mode 100755 index 0000000..3ef450d --- /dev/null +++ b/Potenz.dpr @@ -0,0 +1,19 @@ +program Potenz; + +uses + Forms, + Unit1 in 'Unit1.pas' {Form1}, + Unit2 in 'Unit2.pas' {Form2}, + Unit3 in 'Unit3.pas' {Form3}; + +{$R *.RES} + +begin + Application.Initialize; + Application.Title := 'Potenzübungsprogramm'; + Application.HelpFile := 'Potenz.hlp'; + Application.CreateForm(TForm1, Form1); + Application.CreateForm(TForm2, Form2); + Application.CreateForm(TForm3, Form3); + Application.Run; +end. diff --git a/Potenz.exe b/Potenz.exe new file mode 100755 index 0000000..0a6c7a1 Binary files /dev/null and b/Potenz.exe differ diff --git a/Potenz.hlp b/Potenz.hlp new file mode 100755 index 0000000..d3a335b Binary files /dev/null and b/Potenz.hlp differ diff --git a/Potenz.ico b/Potenz.ico new file mode 100755 index 0000000..bb931bd Binary files /dev/null and b/Potenz.ico differ diff --git a/Potenz.msi b/Potenz.msi new file mode 100755 index 0000000..0752869 Binary files /dev/null and b/Potenz.msi differ diff --git a/Potenz.res b/Potenz.res new file mode 100755 index 0000000..e6c7328 Binary files /dev/null and b/Potenz.res differ diff --git a/Potenz.sh5 b/Potenz.sh5 new file mode 100755 index 0000000..4c4ae91 Binary files /dev/null and b/Potenz.sh5 differ diff --git a/Right.wav b/Right.wav new file mode 100755 index 0000000..265a37f Binary files /dev/null and b/Right.wav differ diff --git a/Unit1.dcu b/Unit1.dcu new file mode 100755 index 0000000..9f87965 Binary files /dev/null and b/Unit1.dcu differ diff --git a/Unit1.dfm b/Unit1.dfm new file mode 100755 index 0000000..d5fd962 Binary files /dev/null and b/Unit1.dfm differ diff --git a/Unit1.pas b/Unit1.pas new file mode 100755 index 0000000..f36be14 --- /dev/null +++ b/Unit1.pas @@ -0,0 +1,738 @@ +unit Unit1; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + Menus, ComCtrls, StdCtrls, Math, CommCtrl, ShellApi, MMSystem, ExtCtrls; + +type + TForm1 = class(TForm) + StatusBar: TStatusBar; + MnuMain: TMainMenu; + MnuArt: TMenuItem; + MnuPotenzeinerPotenz: TMenuItem; + MnuGleicheBasis: TMenuItem; + MnuGleicherExponent: TMenuItem; + MnuHelp: TMenuItem; + MnuBeenden: TMenuItem; + MnuOptionen: TMenuItem; + MnuNeuebung: TMenuItem; + MnuAuswerten: TMenuItem; + TxtSolBas: TEdit; + TxtSolExp: TEdit; + LblExOp2Bas: TLabel; + LblExOp2Exp: TLabel; + BtnSubmit: TButton; + LblEqual: TLabel; + LblExOp1Bas: TLabel; + LblExOp1Exp: TLabel; + LblExOp1ExpExp: TLabel; + LblOp: TLabel; + LblBrackets: TLabel; + BtnNextEx: TButton; + NegativeExponenten1: TMenuItem; + Zahlenbereich1: TMenuItem; + Aufgaben1: TMenuItem; + ProgressBarExRight: TProgressBar; + Zufaellig1: TMenuItem; + Round1: TMenuItem; + StatusBarInstruction: TStatusBar; + ProgressBarEx: TProgressBar; + Ueber1: TMenuItem; + InternetRanking1: TMenuItem; + Hilfe1: TMenuItem; + Timer: TTimer; + Sounds1: TMenuItem; + Zeitanzeigen1: TMenuItem; + BtnCalc: TButton; + LblWelcome: TLabel; + procedure MnuGleicherExponentClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure BtnSubmitClick(Sender: TObject); + procedure MnuPotenzeinerPotenzClick(Sender: TObject); + procedure MnuGleicheBasisClick(Sender: TObject); + procedure BtnNextExClick(Sender: TObject); + procedure FormKeyPress(Sender: TObject; var Key: Char); + procedure NegativeExponenten1Click(Sender: TObject); + procedure Aufgaben1Click(Sender: TObject); + procedure Zahlenbereich1Click(Sender: TObject); + procedure MnuBeendenClick(Sender: TObject); + procedure Zufaellig1Click(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure MnuAuswertenClick(Sender: TObject); + procedure InternetRanking1Click(Sender: TObject); + procedure Round1Click(Sender: TObject); + procedure TimerTimer(Sender: TObject); + procedure Hilfe1Click(Sender: TObject); + procedure Ueber1Click(Sender: TObject); + procedure Sounds1Click(Sender: TObject); + procedure Zeitanzeigen1Click(Sender: TObject); + procedure BtnCalcClick(Sender: TObject); + + private + { Private-Deklarationen} + public + { Public-Deklarationen} + end; + + procedure GleicheBasis; + procedure GleicherExponent; + procedure PotenzeinerPotenz; + procedure ExRandom; + procedure UpdateCounter; + procedure ResetDisplay; + procedure Reset; + function SolRound(value: double; dcpoint: integer): double; + +var + Form1: TForm1; + ExType: Integer; + {0= Keine Übung + 1= Gleicher Exponent + 2= Gleiche Basis + 3= Potenz einer Potenz} + Flag: Boolean; // Richtig oder Falsch? + RanFlag: Boolean; // Zufallsübung? + TimeFlag: Boolean; // Zeit anzeigen? + RoundFlag: Boolean; // ganzzahlige Ergebnisse oder Runden? + NegFlag: Boolean; + SoundFlag: Boolean; + Op: Integer; + {0= /(geteilt) + 1= x (mal)} + SolBas: Integer; // zum Errechnen ganzzahliger Lösungen + Sol: Real; // Lösungen + Op1: Integer; // Operant 1 + Op2: Integer; // Operant 2 + Op3: String; + Constants: Array[1..6] of String; + RangeMax, RangeMin: Integer; // Zahlenbereich + ExMax: Integer; // Wieviele Aufgaben? + Ex: Integer; // Aktuelle Aufgabe + ExRight: Integer; // richtige Aufgaben + ExWrong: Integer; // falsche Aufgaben + TransName: String; // Name für Online Ranking + TransComment: String; // Kommentar für Online Ranking + r: TRect; + s: TRect; + StartTime, TotalTime: Cardinal; // für den Timer + +const + MainUrl = 'http://steffenvogel.de/stff/Programmieren/Delphi/Potenz/Ranking/index.php'; + SoundRight = 'Right.wav'; + SoundWrong = 'Wrong.wav'; + SoundBadResult = 'BadResult.wav'; + SoundGoodResult = 'GoodResult.wav'; + +implementation + +uses Unit2, Unit3; + +{$R *.DFM} + +procedure TForm1.FormCreate(Sender: TObject); +begin + randomize; + RoundFlag := False; + TimeFlag := True; + NegFlag := True; + SoundFlag := True; + Flag := False; + RangeMax := 20; + RangeMin := -20; + ExMax := 20; + + Constants[1] := 'a'; + Constants[2] := 'b'; + Constants[3] := 'c'; + Constants[4] := 'x'; + Constants[5] := 'y'; + Constants[6] := 'z'; + + ExType := 0; + //RanFlag := True; // eventuell auskommentieren + + if ExType <> 0 then + begin + StartTime := GetTickCount; + end; +end; + +procedure TForm1.FormShow(Sender: TObject); +begin + StatusBar.Perform(SB_GETRECT, 1, integer(@R)); + ProgressBarEx.Parent := StatusBar; + ProgressBarEx.BoundsRect := r; + + StatusBar.Perform(SB_GETRECT, 3, integer(@S)); + ProgressBarExRight.Parent := StatusBar; + ProgressBarExRight.BoundsRect := s; + + Form1.BtnNextExClick(Sender); +end; + +function SolRound(value: double; dcpoint: integer): double; +var Multi: Double; +begin + Multi:= IntPower(10, dcpoint); + Value:= Round(Value * Multi); + Result:= Value / Multi; +end; + +procedure UpdateCounter; +begin + if ExType <> 0 then + begin + try + Form1.StatusBar.Panels[0].Text := inttostr(Ex) + '/' + inttostr(ExMax) + ' (' + inttostr(Round((Ex / ExMax)*100)) + '%)'; + Form1.ProgressbarEx.Max := ExMax; + Form1.ProgressbarEx.Position := Ex; + + Form1.StatusBar.Panels[2].Text := inttostr(ExRight) + '/' + inttostr(Ex) + ' (' + inttostr(Round((ExRight / Ex)*100)) + '%)'; + Form1.ProgressbarExRight.Max := Ex; + Form1.ProgressbarExRight.Position := ExRight; + except + //on EZeroDivide do + // begin + Form1.StatusBar.Panels[2].Text := inttostr(ExRight) + '/' + inttostr(Ex) + ' (0%)'; + Form1.StatusBar.Panels[0].Text := inttostr(Ex) + '/' + inttostr(ExMax) + ' (0%)'; + // end; + end; + end; +end; + +procedure ResetDisplay; +begin + Form1.LblExOp1Bas.Visible := False; + Form1.LblExOp1Exp.Visible := False; + Form1.LblExOp1ExpExp.Visible := False; + Form1.LblExOp2Bas.Visible := False; + Form1.LblExOp2Exp.Visible := False; + Form1.LblBrackets.Visible := False; + Form1.LblEqual.Visible := False; + Form1.LblOp.Visible := False; + + Form1.TxtSolBas.Font.Color := clBlack; + Form1.TxtSolExp.Font.Color := clBlack; + + Form1.BtnSubmit.Visible := False; + Form1.BtnNextEx.Visible := False; + Form1.BtnCalc.Visible := False; + + Form1.TxtSolBas.Visible := False; + Form1.TxtSolExp.Visible := False; + + Form1.LblWelcome.Visible := False; + + Form1.TxtSolBas.ReadOnly := False; + Form1.TxtSolExp.ReadOnly := False; + + Form1.LblExOp1Exp.Caption := ''; + Form1.LblExOp2Exp.Caption := ''; + Form1.LblExOp1Bas.Caption := ''; + Form1.LblExOp2Bas.Caption := ''; + Form1.StatusBarInstruction.Panels[0].Text := ''; + Form1.StatusBarInstruction.Panels[1].Text := ''; + Form1.StatusBar.Panels[0].Text := ''; + Form1.StatusBar.Panels[2].Text := ''; + Form1.TxtSolBas.Text := ''; + Form1.TxtSolExp.Text := ''; + + Flag := False; + + Form1.ProgressbarExRight.Max := 100; + Form1.ProgressbarExRight.Position := 0; + + Form1.ProgressbarEx.Max := 100; + Form1.ProgressbarEx.Position := 0; +end; + +procedure Reset; +begin + ResetDisplay; + Form1.LblWelcome.Visible := True; + RanFlag := False; + Form1.StatusBarInstruction.Panels[0].Text := 'Wählen Sie bitte eine Übung aus!'; + ExType := 0; + Ex := 0; + ExRight := 0; + StartTime := 0; + TotalTime := 0; +end; + +procedure GleicherExponent; +begin + ResetDisplay; + + Op := Random(2); + Op1 := Random(RangeMax-RangeMin)+RangeMin; + Op2 := Random(RangeMax-RangeMin)+RangeMin; + Op3 := constants[Random(5) + 1]; + + if (Op1 = 0) or (Op2 = 0) then GleicherExponent; + + if NegFlag = False then + begin + Op1 := Abs(Op1); + Op2 := Abs(Op2); + end; + + if Op = 1 then + begin + Form1.LblOp.Caption := '*'; + Sol := Op1 * Op2; + end + else + begin + Form1.LblOp.Caption := ':'; + if RoundFlag = True then + begin + Sol := SolRound((Op1 / Op2), 2) + end + else + begin + SolBas := Round(Op1 / Op2); + Op1 := SolBas * Op2; + Form1.LblExOp1Bas.Caption := inttostr(Op1); + Sol := Op1 / Op2; + end; + end; + + if (Op1 = 0) or (Op2 = 0) then GleicherExponent; + + Form1.LblExOp2Bas.Caption := inttostr(Op2); + Form1.LblExOp1Bas.Caption := inttostr(Op1); + Form1.LblExOp1Exp.Caption := Op3; + Form1.LblExOp2Exp.Caption := Form1.LblExOp1Exp.Caption; + Form1.StatusBarInstruction.Panels[0].Text := 'Rechnen Sie bitte die Basis aus!'; + Form1.LblExOp1Bas.Visible := True; + Form1.LblExOp1Exp.Visible := True; + Form1.LblBrackets.Visible := False; + Form1.LblExOp2Bas.Visible := True; + Form1.LblExOp2Exp.Visible := True; + Form1.BtnSubmit.Visible := True; + Form1.TxtSolBas.Visible := True; + Form1.TxtSolExp.Visible := True; + Form1.LblEqual.Visible := True; + Form1.LblOp.Visible := True; + Form1.TxtSolBas.SetFocus; + Form1.BtnNextEx.Visible := True; + Form1.BtnSubmit.Enabled := True; + Form1.BtnCalc.Visible := True; + Form1.BtnNextEx.Enabled := False; + Form1.TxtSolBas.SetFocus; + + UpdateCounter; +end; + +procedure GleicheBasis; +begin + ResetDisplay; + + Op := Random(2); + Op1 := Random(RangeMax - RangeMin) + RangeMin; + Op2 := Random(RangeMax - RangeMin) + RangeMin; + Op3 := Constants[Random(5) + 1]; + + if (Op1 = 0) or (Op2 = 0) then GleicheBasis; + + if NegFlag = False then + begin + Op1 := Abs(Op1); + Op2 := Abs(Op2); + end; + + if Op = 1 then + begin + Form1.LblOp.Caption := '*'; + Sol := Op1 + Op2; + end + else + begin + if Op1 = Op2 then GleicheBasis; + Form1.LblOp.Caption := ':'; + Sol := Op1 - Op2; + end; + + Form1.LblExOp1Exp.Caption := inttostr(Op1); + Form1.LblExOp2Exp.Caption := inttostr(Op2); + Form1.LblExOp1Bas.Caption := Op3; + Form1.LblExOp2Bas.Caption := Form1.LblExOp1Bas.Caption; + Form1.StatusBarInstruction.Panels[0].Text := 'Rechnen Sie bitte den Exponenten aus!'; + Form1.LblExOp1Bas.Visible := True; + Form1.LblExOp1Exp.Visible := True; + Form1.LblExOp2Bas.Visible := True; + Form1.LblExOp2Exp.Visible := True; + Form1.BtnSubmit.Visible := True; + Form1.TxtSolBas.Visible := True; + Form1.TxtSolExp.Visible := True; + Form1.LblEqual.Visible := True; + Form1.LblOp.Visible := True; + Form1.TxtSolExp.SetFocus; + Form1.BtnNextEx.Visible := True; + Form1.BtnSubmit.Enabled := True; + Form1.BtnNextEx.Enabled := False; + Form1.BtnCalc.Visible := True; + Form1.TxtSolBas.SetFocus; + + UpdateCounter; +end; + +procedure PotenzeinerPotenz; +begin + ResetDisplay; + + Op1 := Random(RangeMax-RangeMin)+RangeMin; + Op2 := Random(RangeMax-RangeMin)+RangeMin; + Op3 := constants[Random(5) + 1]; + + if (Op1 = 0) or (Op2 = 0) then PotenzeinerPotenz; + + if NegFlag = False then + begin + Op1 := Abs(Op1); + Op2 := Abs(Op2); + end; + + Form1.LblExOp1Exp.Caption := inttostr(Op1); + Form1.LblExOp1ExpExp.Caption := inttostr(Op2); + Sol := Op1 * Op2; + + Form1.LblExOp1Bas.Caption := Op3; + Form1.StatusBarInstruction.Panels[0].Text := 'Rechnen Sie bitte den Exponenten aus!'; + Form1.LblExOp1Bas.Visible := True; + Form1.LblExOp1Exp.Visible := True; + Form1.LblExOp1ExpExp.Visible := True; + Form1.LblBrackets.Visible := True; + Form1.LblOp.Visible := False; + Form1.BtnSubmit.Visible := True; + Form1.TxtSolBas.Visible := True; + Form1.TxtSolExp.Visible := True; + Form1.LblEqual.Visible := True; + Form1.TxtSolExp.SetFocus; + Form1.BtnNextEx.Visible := True; + Form1.BtnSubmit.Enabled := True; + Form1.BtnNextEx.Enabled := False; + Form1.BtnCalc.Visible := True; + Form1.TxtSolBas.SetFocus; + + UpdateCounter; +end; + +procedure ExRandom; +begin + ExType := Random(3) + 1; + case ExType of + 1: GleicherExponent; + 2: GleicheBasis; + 3: PotenzeinerPotenz; + end; +end; + +procedure TForm1.MnuGleicherExponentClick(Sender: TObject); +begin + Reset; + + ExType := 1; + GleicherExponent; + + StartTime := GetTickCount; +end; + +procedure TForm1.MnuGleicheBasisClick(Sender: TObject); +begin + Reset; + + ExType := 2; + GleicheBasis; + + StartTime := GetTickCount; +end; + +procedure TForm1.MnuPotenzeinerPotenzClick(Sender: TObject); +begin + Reset; + + ExType := 3; + PotenzeinerPotenz; + + StartTime := GetTickCount; +end; + +procedure TForm1.Zufaellig1Click(Sender: TObject); +begin + Reset; + + RanFlag := True; + ExRandom; + + StartTime := GetTickCount; +end; + +procedure TForm1.BtnSubmitClick(Sender: TObject); +begin + try + case ExType of + 0: // Keine Übung ausgewählt + StatusBarInstruction.Panels[0].Text := 'Wählen Sie bitte eine Übung aus!'; + + 1: // Gleicher Exponent + if (Sol = SolRound(strtofloat(TxtSolBas.Text), 2)) and (LblExOp1Exp.Caption = TxtSolExp.Text) then + Flag := True + else + begin + Flag := False; + if (Sol = SolRound(strtofloat(TxtSolBas.Text), 2)) and (LblExOp1Exp.Caption <> TxtSolExp.Text) then + TxtSolExp.Font.Color := clRed + else if (Sol <> SolRound(strtofloat(TxtSolBas.Text), 2)) and (LblExOp1Exp.Caption = TxtSolExp.Text) then + TxtSolBas.Font.Color := clRed + else + begin + TxtSolBas.Font.Color := clRed; + TxtSolExp.Font.Color := clRed; + end; + StatusBarInstruction.Panels[0].Text := 'Falsch! ' + FloattoStr(Sol) + ' hoch ' + Op3 + ' wäre richtig gewesen!'; + end; + + 2: // Gleiche Basis + if (Sol = strtofloat(TxtSolExp.Text)) and (Op3 = TxtSolBas.Text) then + Flag := True + else + begin + Flag := False; + if (Sol = SolRound(strtofloat(TxtSolExp.Text), 2)) and (LblExOp1Bas.Caption <> TxtSolBas.Text) then + TxtSolBas.Font.Color := clRed + else if (Sol <> SolRound(strtofloat(TxtSolExp.Text), 2)) and (LblExOp1Bas.Caption = TxtSolBas.Text) then + TxtSolExp.Font.Color := clRed + else + begin + TxtSolBas.Font.Color := clRed; + TxtSolExp.Font.Color := clRed; + end; + StatusBarInstruction.Panels[0].Text := 'Falsch! ' + Op3 + ' hoch ' + floattostr(Sol) + ' wäre richtig gewesen!'; + end; + + 3: // Potenz einer Potenz + if (Sol = strtofloat(TxtSolExp.Text)) and (Op3 = TxtSolBas.Text) then + Flag := True + else + begin + Flag := False; + if (Sol = SolRound(strtofloat(TxtSolExp.Text), 2)) and (LblExOp1Bas.Caption <> TxtSolBas.Text) then + TxtSolBas.Font.Color := clRed + else if (Sol <> SolRound(strtofloat(TxtSolExp.Text), 2)) and (LblExOp1Bas.Caption = TxtSolBas.Text) then + TxtSolExp.Font.Color := clRed + else + begin + TxtSolBas.Font.Color := clRed; + TxtSolExp.Font.Color := clRed; + end; + StatusBarInstruction.Panels[0].Text := 'Falsch! ' + Op3 + ' hoch ' + floattostr(Sol) + ' wäre richtig gewesen!'; + end; + end; + + if Flag = True then + begin + StatusBarInstruction.Panels[0].Text := 'Richtig!'; + BtnNextEx.Enabled := True; + BtnSubmit.Visible := True; + BtnSubmit.Enabled := False; + BtnNextEx.SetFocus; + inc(ExRight); + if RanFlag = True then ExType := 4; + if SoundFlag = True then sndPlaySound(SoundRight, SND_ASYNC); + end + else + begin + BtnNextEx.Enabled := True; + BtnSubmit.Visible := True; + BtnSubmit.Enabled := False; + BtnNextEx.SetFocus; + Flag := True; + inc(ExWrong); + if SoundFlag = True then sndPlaySound(SoundWrong, SND_ASYNC); + end; + inc(Ex); + TxtSolBas.ReadOnly := True; + TxtSolExp.ReadOnly := True; + except + on EConvertError do + StatusBarInstruction.Panels[0].Text := 'Das ist keine Zahl!'; + end; +end; + + +procedure TForm1.BtnNextExClick(Sender: TObject); +begin + if Ex < ExMax then + begin + if RanFlag = True then + ExRandom + else + begin + case ExType of + 0: StatusBarInstruction.Panels[0].Text := 'Wählen Sie bitte eine Übung aus!'; + 1: GleicherExponent; + 2: GleicheBasis; + 3: PotenzeinerPotenz; + end; + end; + end + else + begin + UpdateCounter; + TimeFlag := False; + TimerTimer(Sender); + Form2.ShowModal; + TimeFlag := True; + Reset; + end; +end; + +procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); +begin + case Key of + #13: + if ExType <> 0 then + if Flag = True then + begin + Key := #0; + Form1.BtnNextExClick(Sender) + end + else + begin + Key := #0; + Form1.BtnSubmitClick(Sender); + end; + end; +end; + +procedure TForm1.NegativeExponenten1Click(Sender: TObject); +begin + if NegFlag = True then + begin + NegativeExponenten1.Checked := False; + NegFlag := False; + end + else + begin + NegativeExponenten1.Checked := True; + NegFlag := True; + end; +end; + +procedure TForm1.Aufgaben1Click(Sender: TObject); +begin + try + ExMax := strtoint(InputBox ('Anzahl der Aufgaben', 'Wie viele Aufgaben wollen Sie gestellt bekommen?', inttostr(ExMax))); + except + Application.MessageBox ('Das ist keine Zahl!', 'Fehler', 0+16); + end; + if ExType <> 0 then UpdateCounter; +end; + +procedure TForm1.Zahlenbereich1Click(Sender: TObject); +begin + try + RangeMin := strtoint(InputBox ('Zahlenbereich', 'Wie groß soll die kleinste Zahl sein?', inttostr(RangeMin))); + RangeMax := strtoint(InputBox ('Zahlenbereich', 'Wie groß soll die größte Zahl sein?', inttostr(RangeMax))); + except + Application.MessageBox ('Das ist keine Zahl!', 'Fehler', 0+16); + end; +end; + +procedure TForm1.MnuBeendenClick(Sender: TObject); +begin + Close; +end; + +procedure TForm1.MnuAuswertenClick(Sender: TObject); +begin + if (ExType <> 0) and (Ex >= 1) then + begin + Timer.Enabled := False; + Form2.ShowModal; + Timer.Enabled := True; + Reset; + end + else + Application.MessageBox ('Bitte rechnen Sie zuerst eine Aufgabe!', 'Fehler', 0+48); + +end; + +procedure TForm1.InternetRanking1Click(Sender: TObject); +begin + ShellExecute(Form2.Handle,'open',PChar(MainUrl),nil,nil,SW_SHOWNORMAL); +end; + +procedure TForm1.Round1Click(Sender: TObject); +begin + if RoundFlag = True then + begin + RoundFlag := False; + Round1.Checked := False; + end + else + begin + RoundFlag := True; + Round1.Checked := True; + end; +end; + +procedure TForm1.TimerTimer(Sender: TObject); +begin + if (TimeFlag = True) and (ExType <> 0) then + begin + TotalTime := GetTickCount - StartTime; + StatusBarInstruction.Panels[1].Text := FloattoStrF(TotalTime / 1000, ffFixed, 7, 2) + ' sec'; + end + else + StatusBarInstruction.Panels[1].Text := ''; +end; + +procedure TForm1.Hilfe1Click(Sender: TObject); +begin + Application.HelpCommand(HELP_FINDER, 0); +end; + +procedure TForm1.Ueber1Click(Sender: TObject); +begin + Form3.ShowModal; +end; + +procedure TForm1.Sounds1Click(Sender: TObject); +begin + if SoundFlag = True then + begin + SoundFlag := False; + Sounds1.Checked := False; + end + else + begin + SoundFlag := True; + Sounds1.Checked := True; + end; +end; + +procedure TForm1.Zeitanzeigen1Click(Sender: TObject); +begin + if TimeFlag = True then + begin + TimeFlag := False; + Zeitanzeigen1.Checked := False; + end + else + begin + TimeFlag := True; + Zeitanzeigen1.Checked := True; + end; +end; + +procedure TForm1.BtnCalcClick(Sender: TObject); +begin + ShellExecute(Handle, 'open', 'calc.exe', '', nil, SW_SHOW); +end; + +end. + diff --git a/Unit2.dcu b/Unit2.dcu new file mode 100755 index 0000000..c61d4b5 Binary files /dev/null and b/Unit2.dcu differ diff --git a/Unit2.dfm b/Unit2.dfm new file mode 100755 index 0000000..3e35662 Binary files /dev/null and b/Unit2.dfm differ diff --git a/Unit2.pas b/Unit2.pas new file mode 100755 index 0000000..3584d8a --- /dev/null +++ b/Unit2.pas @@ -0,0 +1,79 @@ +unit Unit2; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, ComCtrls, ShellApi, MMSystem; + +type + TForm2 = class(TForm) + Label1: TLabel; + Label2: TLabel; + ProgressBar: TProgressBar; + BtnClose: TButton; + Transfer: TButton; + procedure FormShow(Sender: TObject); + procedure BtnCloseClick(Sender: TObject); + procedure TransferClick(Sender: TObject); + private + { Private-Deklarationen} + public + { Public-Deklarationen} + end; +var + Form2: TForm2; + Url: String; + Value: Real; + +implementation + +uses Unit1; + +{$R *.DFM} + +procedure TForm2.FormShow(Sender: TObject); +begin + TotalTime := GetTickCount - StartTime; + Value := Round(((ExRight / (TotalTime / Ex)) - (ExWrong / (TotalTime / Ex))) * 1000000); + + if RanFlag = True then Value := Value * 1.5; + if RoundFlag = True then Value := Value * 2; + if NegFlag = True then Value := Value * 1.2; + if Value < 0 then Value := 0; + + Label2.Caption := 'Sie haben ' + inttostr(ExRight) + ' von ' + inttostr(Ex) + ' Aufgaben richtig gelöst.' + Chr(13) + 'Das sind ' + inttostr(Round((ExRight/Ex)*100)) + '%.' + Chr(13) + 'Dafür haben Sie ' + FloattoStrF(TotalTime / 1000, ffFixed, 7, 2) + ' Sekunden gebraucht.' + Chr(13) + 'Insgesamt haben Sie ' + floattostr(Value) + ' Punkte.'; + + Progressbar.Max := ExMax; + Progressbar.Position := ExRight; + + if Round((ExRight / Ex) * 100) > 50 then + if SoundFlag = True then sndPlaySound(SoundGoodResult, SND_LOOP) + else + if SoundFlag = True then sndPlaySound(SoundBadResult, SND_LOOP); +end; + +procedure TForm2.BtnCloseClick(Sender: TObject); +begin + sndPlaySound(nil,0); + Form2.Close; +end; + +procedure TForm2.TransferClick(Sender: TObject); +begin + if Value > 0 then + if InputQuery('Name', 'Wie heißen sie?', TransName) and InputQuery('Kommentar', 'Haben sie noch etwas zu sagen?!', TransComment) then + if TransName = '' then + Application.MessageBox ('Bitte geben Sie ihren Namen an!', 'Fehler', 0+16) + else + begin + Url := MainUrl + '?name=' + TransName + '&value=' + FloattoStr(Value) + '&comment=' + TransComment; + ShellExecute(Form2.Handle,'open',PChar(Url),nil,nil,SW_SHOWNORMAL); + end + else + Application.MessageBox ('Ihre Angaben sind nicht vollständig!', 'Fehler', 0+16) + else + Application.MessageBox ('Sie brauchen mindestens einen Punkt!', 'Nicht genügend Punkte', 0+16); +end; + +end. diff --git a/Unit3.dcu b/Unit3.dcu new file mode 100755 index 0000000..016001f Binary files /dev/null and b/Unit3.dcu differ diff --git a/Unit3.dfm b/Unit3.dfm new file mode 100755 index 0000000..d04c88b Binary files /dev/null and b/Unit3.dfm differ diff --git a/Unit3.pas b/Unit3.pas new file mode 100755 index 0000000..5f9028b --- /dev/null +++ b/Unit3.pas @@ -0,0 +1,44 @@ +unit Unit3; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, ExtCtrls, ComCtrls, ShellApi; + +type + TForm3 = class(TForm) + Image1: TImage; + Label2: TLabel; + Label3: TLabel; + Button1: TButton; + Button2: TButton; + RichEdit1: TRichEdit; + procedure Button2Click(Sender: TObject); + procedure Button1Click(Sender: TObject); + private + { Private-Deklarationen} + public + { Public-Deklarationen} + end; + +var + Form3: TForm3; + +implementation + +uses Unit2; + +{$R *.DFM} + +procedure TForm3.Button2Click(Sender: TObject); +begin + ShellExecute(Form2.Handle,'open','http://www.fsf.org/licensing/licenses/gpl.html',nil,nil,SW_SHOWNORMAL); +end; + +procedure TForm3.Button1Click(Sender: TObject); +begin + Close +end; + +end. diff --git a/Wrong.wav b/Wrong.wav new file mode 100755 index 0000000..7bf5c18 Binary files /dev/null and b/Wrong.wav differ