using System;
using System.Collections.Generic;
using System.Text;
namespace TimerApp
{
class Program
{
static void Main(string[] args)
{
int tipp1, tipp2, tipp3, tipp4, tipp5, tipp6, tipp7, tipp8, tipp9, punkte;
// Neuen Thread erstellen und starten
System.Threading.Thread thread = new System.Threading.Thread(ThreadFunc);
thread.Start();
// 20 Sekunden warten
System.Threading.Thread.Sleep(5*1000);
tipp1 = Convert.ToInt32(Console.ReadLine());
tipp2 = Convert.ToInt32(Console.ReadLine());
tipp3 = Convert.ToInt32(Console.ReadLine());
tipp4 = Convert.ToInt32(Console.ReadLine());
tipp5 = Convert.ToInt32(Console.ReadLine());
tipp6 = Convert.ToInt32(Console.ReadLine());
tipp7 = Convert.ToInt32(Console.ReadLine());
tipp8 = Convert.ToInt32(Console.ReadLine());
tipp9 = Convert.ToInt32(Console.ReadLine());
punkte = Convert.ToInt32(Console.ReadLine());
// Falls der Thread noch nicht beendet wurde, dann den Thread killen
if (thread.IsAlive)
punkte = tipp1 + tipp2 + tipp3 + tipp4 + tipp5 + tipp6 + tipp7 + tipp8 + tipp9;
Console.WriteLine("Ihre Punktezahl beträgt " + punkte);
Console.ReadLine();
thread.Abort();
}
static void ThreadFunc()
{
Random generator/*man kann statt generator jede beliebige variable wählen*/ = new Random();
int zufzahl, tipp1, tipp2, tipp3, tipp4, tipp5, tipp6, tipp7, tipp8, tipp9;
Console.WriteLine("Wie oft können Sie die Zufallszahl mal 2 rechen?");
Console.ReadLine();
zufzahl = generator.Next(2, 49);
Console.WriteLine(zufzahl);
Console.WriteLine("Rechnen sie diese Zahl mal 2!");
tipp1 = Convert.ToInt32(Console.ReadLine());
if (tipp1 < zufzahl * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3500);
System.Environment.Exit(0);
}
if (tipp1 > zufzahl * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3000);
System.Environment.Exit(0);
}
Console.WriteLine("Wieder mal 2!");
tipp2 = Convert.ToInt32(Console.ReadLine());
if (tipp2 < tipp1 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3500);
System.Environment.Exit(0);
}
if (tipp2 > tipp1 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3000);
System.Environment.Exit(0);
}
Console.WriteLine("Noch einmal!");
tipp3 = Convert.ToInt32(Console.ReadLine());
if (tipp3 < tipp2 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3500);
System.Environment.Exit(0);
}
if (tipp3 > tipp2 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3000);
System.Environment.Exit(0);
}
Console.WriteLine("Weiter so!");
tipp4 = Convert.ToInt32(Console.ReadLine());
if (tipp4 < tipp3 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3500);
System.Environment.Exit(0);
}
if (tipp4 > tipp3 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3000);
System.Environment.Exit(0);
}
Console.WriteLine("Nochmal!");
tipp5 = Convert.ToInt32(Console.ReadLine());
if (tipp5 < tipp4 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3500);
System.Environment.Exit(0);
}
if (tipp5 > tipp4 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3000);
System.Environment.Exit(0);
}
Console.WriteLine("Es geht noch!");
tipp6 = Convert.ToInt32(Console.ReadLine());
if (tipp6 < tipp5 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3500);
System.Environment.Exit(0);
}
if (tipp6 > tipp5 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3000);
System.Environment.Exit(0);
}
Console.WriteLine("Einmal gehts noch!");
tipp7 = Convert.ToInt32(Console.ReadLine());
if (tipp7 < tipp6 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3500);
System.Environment.Exit(0);
}
if (tipp7 > tipp6 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3000);
System.Environment.Exit(0);
}
Console.WriteLine("Uuuuuuuh!");
tipp8 = Convert.ToInt32(Console.ReadLine());
if (tipp8 < tipp7 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3500);
System.Environment.Exit(0);
}
if (tipp8 > tipp7 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3000);
System.Environment.Exit(0);
}
Console.WriteLine("Sehr gut!");
tipp9 = Convert.ToInt32(Console.ReadLine());
if (tipp9 < tipp8 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3500);
System.Environment.Exit(0);
}
if (tipp9 > tipp8 * 2)
{
Console.WriteLine("Das Ergebnis ist nicht richtig! Versuchen sie es erneut!");
System.Threading.Thread.Sleep(3000);
System.Environment.Exit(0);
}
}
}
}