![]() |
AW: Lotto Systemspiele berechnen
Danke MrSpock, schau ich mir an.
Was hälst du davon?
Delphi-Quellcode:
Nun bleibt noch das VEW.
procedure TForm1.Button1Click(Sender: TObject);
type TSpiel = record z1, z2, z3, z4, z5, z6: integer; end; var i, k, l, m, n, o, p, max: integer; tipps: array of TSpiel; tipp: array[1..16] of integer; begin for i:= 1 to 16 do tipp[i]:= i; // bzw. individueller Tipp max := 16; i := 1; for k := 1 to max - 5 do for l := k + 1 to max - 4 do for m := l + 1 to max - 3 do for n := m + 1 to max - 2 do for o := n + 1 to max - 1 do for p := o + 1 to max do begin SetLength(tipps, i); tipps[i - 1].z1 := tipp[k]; tipps[i - 1].z2 := tipp[l]; tipps[i - 1].z3 := tipp[m]; tipps[i - 1].z4 := tipp[n]; tipps[i - 1].z5 := tipp[o]; tipps[i - 1].z6 := tipp[p]; inc(i); end; Memo1.Lines.Clear; Memo1.Lines.BeginUpdate; for i := Low(tipps) to high(tipps) do begin Memo1.Lines.Add(IntToStr(tipps[i].z1) + ' ' + IntToStr(tipps[i].z2) + ' ' + IntToStr(tipps[i].z3) + ' ' + IntToStr(tipps[i].z4) + ' ' + IntToStr(tipps[i].z5) + ' ' + IntToStr(tipps[i].z6)); end; Memo1.Lines.EndUpdate; Caption := IntToStr(Memo1.Lines.Count) + ' Tippreihen'; end; Sind das von Lotto festgelegte Kombinationen die man sich definieren muss? |
AW: Lotto Systemspiele berechnen
Hab den Thread nur kurz überflogen. Meinst du so etwas:
Delphi-Quellcode:
Komlett rekursiv.
Procedure TForm1.CalcCombinatoricGenes (CombinatoricResult, Rest : String; CalcDepth : Integer);
Var Runner : Longint; Counter : Int64; Begin // If (Rest='') Or (CalcDepth=0) THen // Begin // If CheckRules (CombinatoricResult)THen // Begin // ListBox1.Items.Add(CombinatoricResult); // end; ListBox1.Items.Add (CombinatoricResult); end Else Begin For Runner := 1 to Length (Rest) do Begin CalcCombinatoricGenes (CombinatoricResult + Rest [Runner], Copy (Rest, 1, Runner-1) + Copy (Rest, Runner+1, Length (Rest)-1), CalcDepth-1); end; end; end; procedure TForm1.BitBtn1Click(Sender: TObject); begin CalcCombinatoricGenes ( '', '123456789', 5); end; - CombinatoricResult enthält die Ergebnisse - Rest enthält die noch nicht entnommenen Elemente; bei erstem Aufruf die übergebene Liste der zur Verfügung stehenden Elemente - Depth sagt, wie viele Elemente aus der Ursprungsmenge von Rest entnommen werden sollen Für deine Anwendung müsstest du dir überlegen, wie du deine Zahlen/Elemente 'tokenisen' kannst. Z.B. in Chars umwandeln. Bin mir aber gerade nicht sicher, ob das komplett Unicode konform ist... Falls das komplett am Ziel vorbei schießt, schmeist meinen Beitrag einfach aus dem Thread... Jan |
AW: Lotto Systemspiele berechnen
Auf den ersten Blick: Das löppt so nicht ...
|
AW: Lotto Systemspiele berechnen
Zitat:
|
AW: Lotto Systemspiele berechnen
Zitat:
|
AW: Lotto Systemspiele berechnen
Zitat:
|
AW: Lotto Systemspiele berechnen
Alle möglichen Kombinationen (nicht sortiert).
Beispiel: N = 3 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 |
AW: Lotto Systemspiele berechnen
Zitat:
|
AW: Lotto Systemspiele berechnen
Zitat:
Kein Mensch hat was anderes behauptet, ich benötige das für etwas anderes, -> siehe # 25. |
AW: Lotto Systemspiele berechnen
Zitat:
Das was du suchst, nennt sich "Permutation" und sollte ohne Probleme hier im Forum zu finden sein. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:05 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz