using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Meny
{
static void Main()
{
while (true)
{
//Alternativa val//
Console.WriteLine("\n\n\t Välkommen Till HängaGubbe \n\n");
Console.WriteLine("\n\n\t[1] Lägg till ord");
Console.WriteLine("\t[2] Lista alla ord");
Console.WriteLine("\t[3] Spela");
Console.WriteLine("\t[4] Avsluta");
Console.Write("\n\tVälj 1-4: ");
//Här får spelaren välja alternativ//
string menySelection = Console.ReadLine();
if (menySelection == "1")
{
Console.WriteLine("\n\n\t Lägg till egna ord");
//Här lägger spelaren till 5 egna ord//
string[] ordLista = new string[10];
ordLista[0] = Console.ReadLine();
ordLista[1] = Console.ReadLine();
ordLista[2] = Console.ReadLine();
ordLista[3] = Console.ReadLine();
ordLista[4] = Console.ReadLine();
//Slumpvalda ord ifrån ordlistan//
Random randGen = new Random();
var idx = randGen.Next(0, 4);
string secretword = ordLista[idx];
char[] guessword = new char[secretword.Length];
char guess;
bool rightword = false;
Program kontroll = new Program();
for (int i = 0; i < guessword.Length; i++)
{
guessword[i] = '-';
}
Console.Write("\n\n\t");
for (int i = 0; i < guessword.Length; i++)
{
Console.Write(guessword[i]);
}
Console.WriteLine("\n\tGissa fram ordet!");
while (!rightword)
{
Console.Write("\n\tFörsök igen : ");
guess = Convert.ToChar(Console.ReadLine());
kontroll.wordcontrol(secretword, guessword, guess);
rightword = kontroll.RO(secretword, guessword);
}
}
else if (menySelection == "2")
{
//Här väljs ordet ut//
Console.WriteLine("\n\n\t0= Ordlista =0\n");
Ordlista showing = new Ordlista();
showing.OrdLista();
Console.WriteLine("\n\t====================");
}
else if (menySelection == "3")
{
while (true)
{
Console.WriteLine("\n\n\t0= Välkommen till HängaGubbe! =0");
//Ordlista//
string[] ordLista = new string[10];
ordLista[0] = "kebabtalrik";
ordLista[1] = "kebabrulle";
ordLista[2] = "baconburgare";
//Generator ett ord slumpmässigt//
Random randGen = new Random();
var idx = randGen.Next(0, 2);
string secretword = ordLista[idx];
char[] guessword = new char[secretword.Length];
char gissa;
bool rightword = false;
Program kontroll = new Program();
for (int i = 0; i < guessword.Length; i++)
{
guessword[i] = '-';
}
Console.Write("\n\n\t");
for (int i = 0; i < guessword.Length; i++)
{
Console.Write(guessword[i]);
}
Console.WriteLine("\n\tGissa dig fram till ordet!");
while (!rightword)
{
Console.Write("\n\tFörsök Igen : ");
gissa = Convert.ToChar(Console.ReadLine());
kontroll.wordcontrol(secretword, guessword, gissa);
rightword = kontroll.RO(secretword, guessword);
}
}
}
//Avslutar Spelet//
else if (menySelection == "4")
{
Console.WriteLine("\n\n\t8= Bye! =8\n\n\n\n\n");
break;
}
else
{
//Meddelar vid error//
Console.WriteLine("\n\tFEL!");
}
}
}
}