qa
iespecially if it merges an updated upstream into a topic branch.
This commit is contained in:
abdelaziz 2025-06-17 21:46:57 +02:00
commit d1984241db
10 changed files with 922 additions and 0 deletions

289
.gitignore vendored Normal file
View File

@ -0,0 +1,289 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# VS Code
.vscode/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

25
LOTO/LOTO.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35931.197 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LOTO", "LOTO\LOTO.csproj", "{B2D67C5F-CC7C-436C-B5AC-2EB33DACD937}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B2D67C5F-CC7C-436C-B5AC-2EB33DACD937}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2D67C5F-CC7C-436C-B5AC-2EB33DACD937}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2D67C5F-CC7C-436C-B5AC-2EB33DACD937}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2D67C5F-CC7C-436C-B5AC-2EB33DACD937}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4AC806A9-C448-43FC-9BB1-96155BB7978B}
EndGlobalSection
EndGlobal

9
LOTO/LOTO/App.xaml Normal file
View File

@ -0,0 +1,9 @@
<Application x:Class="LOTO.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:LOTO"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

14
LOTO/LOTO/App.xaml.cs Normal file
View File

@ -0,0 +1,14 @@
using System.Configuration;
using System.Data;
using System.Windows;
namespace LOTO
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

10
LOTO/LOTO/AssemblyInfo.cs Normal file
View File

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

11
LOTO/LOTO/LOTO.csproj Normal file
View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>

98
LOTO/LOTO/Lotto.cs Normal file
View File

@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LOTO
{
internal class Lotto
{
int[] matchCounts = new int[7];
//Random array erzeuger
public int[] RandomNumbers()
{
Random rn = new Random();
bool dupl;
int[] x = new int[6];
for (int i = 0; i < 6; i++)
{
int y = rn.Next(1, 50);
dupl = DuplicateChecker(x, y);
while (dupl == true)
{
y = rn.Next(1, 50);
dupl = DuplicateChecker(x, y);
}
x[i] = y;
}
return x;
}
//Prüft duplizierte Zahlen in einem array
public bool DuplicateChecker(int[] x, int z)
{
for (int i = 0; i < x.Length; i++)
{
if (x[i] == z)
{
return true;
}
}
return false;
}
//recursiv binary search ,der prüft eine Zahl ,ob sie in einem Array liegt.
public bool RevursivBinarySearch(int[] arry, int target, int left, int right)
{
int mid = (left + right) / 2;
if (left > right)
{
return false;
}
if (arry[mid] == target)
{
return true;
}
else if (arry[mid] < target)
{
left = mid + 1;
return RevursivBinarySearch(arry, target, left, right);
}
else
{
right = mid - 1;
return RevursivBinarySearch(arry, target, left, right);
}
}
//addiert die Zhal der arrays,der i matches haben
public int[] Stats(int count)
{
if (count > 0)
{
matchCounts[count]++;
}
return matchCounts;
}
//rechnet die Möglichkeit der Gewinn
public double Möglichkeit(int ticket)
{
//13983816 ist die Gesamtzahl der möglichen Kombinationen für Lotto 6/49 ( C(m,n) = m! / (n! × (m-n)!) )
int m = 13983816;
double möglichkeit = (double)ticket / m;
return Math.Round(möglichkeit, 12);
}
}
}

82
LOTO/LOTO/MainWindow.xaml Normal file
View File

@ -0,0 +1,82 @@
<Window x:Class="LOTO.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Lotto Spiel" Height="600" Width="800"
Background="White" Foreground="Black"
WindowStartupLocation="CenterScreen">
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Eingabe Bereich -->
<StackPanel Grid.Row="0" Margin="0,0,0,20">
<Label Content="Wie viele Tickets möchten Sie kaufen?" FontWeight="Bold"/>
<TextBox x:Name="txtTicketCount" Width="100" HorizontalAlignment="Left" Margin="0,5,0,10"/>
<Label Content="Sollen die Tickets zufällig ausgefüllt werden?" FontWeight="Bold"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,10">
<RadioButton x:Name="rbAllesRandom" Content="Ja (Alle zufällig)" Margin="0,0,20,0" IsChecked="True"/>
<RadioButton x:Name="rbMixed" Content="Nein (Für jedes Ticket wählen)"/>
</StackPanel>
<Button x:Name="btnSpielStarten" Content="Spiel starten" Width="120" Height="30"
HorizontalAlignment="Left" Click="BtnSpielStarten"
Background="White" BorderBrush="Black" BorderThickness="1"/>
</StackPanel>
<!-- Manuelle Eingabe Bereich (versteckt) -->
<StackPanel x:Name="ManuellPanelInput" Grid.Row="1" Visibility="Collapsed" Margin="0,0,0,20">
<Label x:Name="aktuellesLabelticket" Content="" FontWeight="Bold"/>
<Label Content="Wie möchten Sie dieses Ticket ausfüllen:"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,10">
<RadioButton x:Name="rbManuell" Content="Manuell" Margin="0,0,20,0" IsChecked="True"/>
<RadioButton x:Name="rbTicketRandom" Content="Zufällig"/>
</StackPanel>
<!-- Manuelle Zahleneingabe -->
<StackPanel x:Name="ZahlPanelInput" Margin="0,10,0,10">
<Label Content="Geben Sie Ihre Zahlen ein (1-49):"/>
<WrapPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,10,5">
<Label Content="1:" Width="20"/>
<TextBox x:Name="txt1" Width="40" Margin="5,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,10,5">
<Label Content="2:" Width="20"/>
<TextBox x:Name="txt2" Width="40" Margin="5,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,10,5">
<Label Content="3:" Width="20"/>
<TextBox x:Name="txt3" Width="40" Margin="5,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,10,5">
<Label Content="4:" Width="20"/>
<TextBox x:Name="txt4" Width="40" Margin="5,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,10,5">
<Label Content="5:" Width="20"/>
<TextBox x:Name="txt5" Width="40" Margin="5,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,10,5">
<Label Content="6:" Width="20"/>
<TextBox x:Name="txt6" Width="40" Margin="5,0"/>
</StackPanel>
</WrapPanel>
</StackPanel>
<Button x:Name="btnSubmitTicket" Content="Ticket bestätigen" Width="140" Height="30"
HorizontalAlignment="Left" Click="BtnBestätigen"
Background="White" BorderBrush="Black" BorderThickness="1"/>
</StackPanel>
<!-- Ergebnisse Bereich -->
<ScrollViewer Grid.Row="3" Background="Black" Foreground="White" Margin="0,10,0,10">
<TextBlock x:Name="txtErgebnisse" Padding="10" FontFamily="Consolas" FontSize="12"
TextWrapping="Wrap" Background="Black" Foreground="White"/>
</ScrollViewer>
</Grid>
</Window>

View File

@ -0,0 +1,249 @@
using System.Windows;
using System.Windows.Controls;
namespace LOTO
{
public partial class MainWindow : Window
{
//new operator von Lotto class
private Lotto lotto = new Lotto();
private List<int[]> tickets = new List<int[]>();
private int ticketsZahl = 0;
private int aktuellesTicketIndex = 0;
public MainWindow()
{
InitializeComponent();
// Wenn dieses Optionsfeld angeklickt ist, wird diese Methode ausgeführt
rbMixed.Checked += RbMixed_Checked;
rbAllesRandom.Checked += RbAllesRandom_Checked;
rbManuell.Checked += RbManuell_Checked;
rbTicketRandom.Checked += RbTicketRandom_Checked;
}
private void RbMixed_Checked(object sender, RoutedEventArgs e)
{
// Mixed mode wird in SpielStarten behandelt
}
private void RbAllesRandom_Checked(object sender, RoutedEventArgs e)
{
//Das Panel wird ausgeblendet,wenn allesrandom radio button ausgewählt wird.
ManuellPanelInput.Visibility = Visibility.Collapsed;
}
private void RbManuell_Checked(object sender, RoutedEventArgs e)
{
//macht ZahlPanel sichbar ,wenn Manuell radio button ausgewählt wird
ZahlPanelInput.Visibility = Visibility.Visible;
}
private void RbTicketRandom_Checked(object sender, RoutedEventArgs e)
{
//macht den Panel von Zahlen unsihtbar,wenn radio button von Ticket random ausgeqählt wird.
ZahlPanelInput.Visibility = Visibility.Collapsed;
}
//Event Handler von Button der Spiel Starten
private void BtnSpielStarten(object sender, RoutedEventArgs e)
{
ticketsZahl = Convert.ToInt32(txtTicketCount.Text);
if (ticketsZahl <= 0)
{
MessageBox.Show("Bitte geben Sie eine gültige Ticketanzahl ein.", "Ungültige Eingabe", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
aktuellesTicketIndex = 0;
btnSpielStarten.IsEnabled = false;
if (rbAllesRandom.IsChecked == true)
{
// All random tickets
for (int i = 0; i < ticketsZahl; i++)
{
tickets.Add(lotto.RandomNumbers());
}
Process();
}
else
{
// Mixed mode
ShowTicketInput();
}
}
private void ShowTicketInput()
{
if (aktuellesTicketIndex < ticketsZahl)
{
ManuellPanelInput.Visibility = Visibility.Visible;
aktuellesLabelticket.Content = $"Ticket {aktuellesTicketIndex + 1} von {ticketsZahl}";
// Vorherige Eingaben löschen
txt1.Text = txt2.Text = txt3.Text = txt4.Text = txt5.Text = txt6.Text = "";
}
else
{
//wenn alle Tickets gefüllt werden,start prozessing und macht den Panel von Inputs unsichtbar.
ManuellPanelInput.Visibility = Visibility.Collapsed;
Process();
}
}
private void BtnBestätigen(object sender, RoutedEventArgs e)
{
if (rbTicketRandom.IsChecked == true)
{
// Random ticket
tickets.Add(lotto.RandomNumbers());
}
else
{
// Manual ticket
int[] numbers = new int[6];
TextBox[] textBoxes = { txt1, txt2, txt3, txt4, txt5, txt6 };
// Prüft jeder gegebene zahl
for (int i = 0; i < 6; i++)
{
int number = Convert.ToInt32(textBoxes[i].Text);
// Validation
if (number < 1 || number > 49)
{
MessageBox.Show($"Bitte geben Sie eine gültige Nummer (1-49) für die Position {i + 1} ein.", "Ungültige Eingabe", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
// Prüft Duplikation
if (lotto.DuplicateChecker(numbers, number))
{
MessageBox.Show("Bitte geben Sie 6 verschiedene Zahlen ein.", "Doppelte Nummern", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
// Addiert Zahl zu Array
numbers[i] = number;
}
// Gültig Array wird in die List hinzugefügt
tickets.Add(numbers);
}
// Index wird aktualisiert
aktuellesTicketIndex++;
// Ruft die Method wieder auf,um ein anderes Panel zu erzeugen.
ShowTicketInput();
}
//Hiere verwenden wir result als ein container,der alles text ,die wird erzeugt und zeigt speichert.
private void Process()
{
ManuellPanelInput.Visibility = Visibility.Collapsed;
// erzeugen GewinnZahlen
int[] winZahlen = lotto.RandomNumbers();
// Ergebnise zeigen
string result = "";
result += "The winning numbers are: " + string.Join(", ", winZahlen) + "\n\n";
// Alle tickets zeigen
for (int i = 0; i < tickets.Count; i++)
{
result += $"Ticket {i + 1}: " + string.Join(", ", tickets[i]) + "\n";
}
result += "\n";
// vergleichen und die ergebnisse zeigen
for (int i = 0; i < tickets.Count; i++)
{
result += VergleichTicket(tickets[i], winZahlen, i + 1) + "\n";
}
// Wahrscheinlichkeit zeigen
result += "\n" + GetStatistics() + "\n";
result += $"Die Warscheinlichkeit von {ticketsZahl} tickets its: {lotto.Möglichkeit(ticketsZahl):F10}\n";
txtErgebnisse.Text = result;
}
//vergleichen wir jeder Ticket mit dem Gewinnarray
private string VergleichTicket(int[] userNumbers, int[] winNumbers, int ticketNumber)
{
//array sortieren ,um recursiv binary search zu verwenden.
Array.Sort(winNumbers);
int count = 0;
string result = "";
for (int i = 0; i < 6; i++)
{
//count von Matches steigt,wenn die Method true gibt aus.
if (lotto.RevursivBinarySearch(winNumbers, userNumbers[i], 0, winNumbers.Length - 1))
{
count++;
}
}
//wenn ein Ticket hat 6 matches ,dass heißt,dass der Spieler gewonnen hat.
if (count == 6)
{
result = "**************************************************\n";
result += "You are a winner sir, sie haben 6 matches\n";
result += $"Sie Haben mit Ticket {ticketNumber} gewonnen\n";
result += "**************************************************";
}
else
{
//zeigt ,wie viel matches die Ticket hat.
result = $"Ticket {ticketNumber} hat {count} matches\n";
}
lotto.Stats(count);
return result;
}
private string GetStatistics()
{
string stats = "";
//Ruft Stats Method auf ,um die MathchCounts zu bekommen.(Stats(0) ruft Daten ab, ohne die Zähler zu erhöhen),
int[] matchCounts = lotto.Stats(0);
for (int i = 0; i < 7; i++)
{
if (matchCounts[i] > 0)
{
stats += $"Es Gibt {matchCounts[i]} tickets ,die {i} matches haben \n";
}
}
return stats;
}
}
}

135
README.md Normal file
View File

@ -0,0 +1,135 @@
Lotto Spiel - WPF Anwendung
1. Was ist das Programm und was macht es?
Das Lotto Spiel ist eine WPF-Anwendung, die ein deutsches 6/49 Lotto-Spiel simuliert. Der Benutzer kann mehrere Tickets kaufen und wählen, ob er die Zahlen manuell eingeben oder zufällig generieren lassen möchte. Das Programm vergleicht dann die Spieler-Tickets mit den Gewinnzahlen und zeigt die Ergebnisse mit Statistiken und Gewinnwahrscheinlichkeiten an.
Hauptfunktionen:
Mehrere Tickets gleichzeitig spielen
Zwei Modi: Alle Tickets zufällig oder individuelle Auswahl pro Ticket
Manuelle Zahleneingabe mit Validierung (1-49, keine Duplikate)
Automatische Gewinnzahlen-Generierung
Vergleich aller Tickets mit Gewinnzahlen
Statistiken über Matches pro Ticket
Berechnung der Gewinnwahrscheinlichkeit
2. Was wurde erfolgreich implementiert
WPF Interface:
Eingabebereich für Ticketanzahl
Radiobuttons für Spielmodi
Dynamische Anzeige für manuelle Zahleneingabe
Ergebnisbereich mit Scroll-Funktion
Spiellogik:
Zufällige Zahlengenerierung ohne Duplikate
Manuelle Eingabe mit Validierung (Bereich 1-49, keine Duplikate)
Vergleich von Spieler-Tickets mit Gewinnzahlen
Recursive Binary Search für Zahlenvergleich
Statistiken:
Zählung der Matches pro Ticket (0-6 Treffer)
Gesamtstatistik aller gespielten Tickets
Berechnung der Gewinnwahrscheinlichkeit
Datenstrukturen:
Liste von int-Arrays für Ticket-Verwaltung
Array für Match-Statistiken
3. Was nicht implementiert wurde
Fehlende Sachen:
"Spiel wieder starten" Button
"Programm beenden" Button
Preisverteilung (wie viel Geld man gewinnt)
Try-Catch für Fehlerbehandlung
4. Aufgabenverteilung im Team
Saad Akki:
MainWindow.xaml (XAML-Struktur)
Design und Layout der Benutzeroberfläche
Buttons, Labels, TextBoxes
Styling und Visual Properties
Grid-Layout und Panel-Anordnung
Abdelaziz Elouazzani:
MainWindow.xaml.cs (Code-Behind)
Event-Handler für alle Buttons und RadioButtons
Logik für UI-Interaktionen
Datenflow zwischen UI und Lotto-Klasse
Ergebnis-Anzeige und Formatierung
Khadija:
Lotto.cs (Business Logic Klasse)
Algorithmen für Zahlengenerierung
Duplicate Checker Methode
Recursive Binary Search Implementation
Statistik-Berechnungen und Wahrscheinlichkeits-Mathematik
Teamarbeit: Wir haben kontinuierlich zusammengearbeitet, um die Verbindung zwischen den Klassen sicherzustellen und die Integration zu testen.
5. Entwicklungsansatz
Wir haben einen Console-First Ansatz verwendet:
Phase 1: Vollständige Implementation als Konsolen-Anwendung
Klare Vision der Programmlogik entwickeln
Algorithmen testen und verfeinern
Einfache Modifikationen ohne UI-Anpassungen
Phase 2: Konvertierung zu WPF-Anwendung
Core-Logik aus Console-Version übernommen
UI-spezifische Anpassungen hinzugefügt
Event-driven Programming implementiert
Dieser Ansatz hat uns geholfen, die komplexe Logik erst zu verstehen, bevor wir sie in eine graphische Oberfläche integrierten.
6. Probleme und Lösungen
Problem 1: Programm-Aufbau
Problem: Wie baut man ein komplettes Lotto-System?
Lösung: Zwei Modi gemacht (alle zufällig oder einzeln wählen) damit es benutzerfreundlicher ist
Problem 2: Wahrscheinlichkeits-Anzeige
Problem: Wie zeigt man sehr kleine Dezimalzahlen richtig an?
Lösung: F:10 Format verwendet für 10 Dezimalstellen
Problem 3: Duplicate Checker Problem
Problem: DuplicateChecker hat immer "true" gesagt bei gefüllten Arrays
Was war falsch: Methode hat Zahl gegen sich selbst im Array geprüft
Lösung: Logik geändert - während des Befüllens prüfen, nicht nachher
Problem 4: Mehrere Tickets verwalten
Problem: Wie kann man viele Tickets gleichzeitig verwalten?
Lösung: List<int[]> verwendet für alle Tickets
Problem 5: Interface-Kontrolle
Problem: Panels richtig ein- und ausblenden je nach Benutzer-Wahl
Lösung: Event-Handler für RadioButtons mit Visibility-Eigenschaften
7. Was wir gelernt haben
Was wir technisch gelernt haben:
Recursive Algorithmen: Binary Search verstehen und programmieren
String-Formatierung: verschiedene Format-Arten wie F10
WPF programmieren: Events, XAML-Design, Code-Behind
Listen und Arrays: praktisch verwenden im Programm
Input-Prüfung: wie man falsche Eingaben verhindert
Allgemein:
Erst Console-Version machen, dann WPF ist einfacher
Zusammenarbeit im Team und Code verbinden
Schwierige Bugs finden und lösen
8. Was man verbessern könnte
Try-Catch für bessere Fehlerbehandlung
"Neues Spiel" und "Exit" Buttons hinzufügen
Bessere Fehlermeldungen für Benutzer
Preissystem: wie viel Geld man gewinnt
Andere Lotto-Arten (6/45, 5/42)
Schönere Animationen
Mehrere Sprachen
9. Quellen
[Quellen werden später hinzugefügt]
Klassen-Struktur:
MainWindow.xaml: UI-Layout und Design
MainWindow.xaml.cs: Event-Handling und UI-Logik
Lotto.cs: Core-Spiellogik und Mathematik
Entwickelt von: Saad Akki, Abdelaziz Elouazzani, Khadija