private static void Main(string[] аргументи)
        {
            string command = string.Empty;
            char[,] poleto = create_igralno_pole();
            char[,] bombite = slojibombite();
            int broya4 = 0;
            bool grum = false;
            List<zaKlasiraneto> shampion4eta = new List<zaKlasiraneto>(6);
            int red = 0;
            int kolona = 0;
            bool flag = true;
            const int maks = 35;
            bool flag2 = false;

            do
            {
                if (flag)
                {
                    Console.WriteLine(
                        "Hajde da igraem na “Mini4KI”. Probvaj si kasmeta da otkriesh poleteta bez mini4ki."
                        + " Komanda 'top' pokazva klasiraneto, 'restart' po4va nova igra, 'exit' izliza i hajde 4ao!");
                    dumpp(poleto);
                    flag = false;
                }

                Console.Write("Daj red i kolona : ");
                command = Console.ReadLine().Trim();
                if (command.Length >= 3)
                {
                    if (int.TryParse(command[0].ToString(), out red) && int.TryParse(command[2].ToString(), out kolona)
                        && red <= poleto.GetLength(0) && kolona <= poleto.GetLength(1))
                    {
                        command = "turn";
                    }
                }

                switch (command)
                {
                    case "top":
                        klasacia(shampion4eta);
                        break;
                    case "restart":
                        poleto = create_igralno_pole();
                        bombite = slojibombite();
                        dumpp(poleto);
                        grum = false;
                        flag = false;
                        break;
                    case "exit":
                        Console.WriteLine("4a0, 4a0, 4a0!");
                        break;
                    case "turn":
                        if (bombite[red, kolona] != '*')
                        {
                            if (bombite[red, kolona] == '-')
                            {
                                tisinahod(poleto, bombite, red, kolona);
                                broya4++;
                            }

                            if (maks == broya4)
                            {
                                flag2 = true;
                            }
                            else
                            {
                                dumpp(poleto);
                            }
                        }
                        else
                        {
                            grum = true;
                        }

                        break;
                    default:
                        Console.WriteLine("\nGreshka! nevalidna Komanda\n");
                        break;
                }

                if (grum)
                {
                    dumpp(bombite);
                    Console.Write("\nHrrrrrr! Umria gerojski s {0} to4ki. " + "Daj si niknejm: ", broya4);
                    string niknejm = Console.ReadLine();
                    zaKlasiraneto t = new zaKlasiraneto(niknejm, broya4);
                    if (shampion4eta.Count < 5)
                    {
                        shampion4eta.Add(t);
                    }
                    else
                    {
                        for (int i = 0; i < shampion4eta.Count; i++)
                        {
                            if (shampion4eta[i].kolko < t.kolko)
                            {
                                shampion4eta.Insert(i, t);
                                shampion4eta.RemoveAt(shampion4eta.Count - 1);
                                break;
                            }
                        }
                    }

                    shampion4eta.Sort((zaKlasiraneto r1, zaKlasiraneto r2) => r2.igra4.CompareTo(r1.igra4));
                    shampion4eta.Sort((zaKlasiraneto r1, zaKlasiraneto r2) => r2.kolko.CompareTo(r1.kolko));
                    klasacia(shampion4eta);

                    poleto = create_igralno_pole();
                    bombite = slojibombite();
                    broya4 = 0;
                    grum = false;
                    flag = true;
                }

                if (flag2)
                {
                    Console.WriteLine("\nBRAVOOOS! Otvri 35 kletki bez kapka kryv.");
                    dumpp(bombite);
                    Console.WriteLine("Daj si imeto, batka: ");
                    string imeee = Console.ReadLine();
                    zaKlasiraneto to4kii = new zaKlasiraneto(imeee, broya4);
                    shampion4eta.Add(to4kii);
                    klasacia(shampion4eta);
                    poleto = create_igralno_pole();
                    bombite = slojibombite();
                    broya4 = 0;
                    flag2 = false;
                    flag = true;
                }
            }
            while (command != "exit");
            Console.WriteLine("Made in Bulgaria - Uauahahahahaha!");
            Console.WriteLine("AREEEEEEeeeeeee.");
            Console.Read();
        }
Exemple #2
0
        private static void Main(string[] аргументи)
        {
            string command = string.Empty;

            char[,] poleto  = create_igralno_pole();
            char[,] bombite = slojibombite();
            int  broya4 = 0;
            bool grum   = false;
            List <zaKlasiraneto> shampion4eta = new List <zaKlasiraneto>(6);
            int       red    = 0;
            int       kolona = 0;
            bool      flag   = true;
            const int maks   = 35;
            bool      flag2  = false;

            do
            {
                if (flag)
                {
                    Console.WriteLine(
                        "Hajde da igraem na “Mini4KI”. Probvaj si kasmeta da otkriesh poleteta bez mini4ki."
                        + " Komanda 'top' pokazva klasiraneto, 'restart' po4va nova igra, 'exit' izliza i hajde 4ao!");
                    dumpp(poleto);
                    flag = false;
                }

                Console.Write("Daj red i kolona : ");
                command = Console.ReadLine().Trim();
                if (command.Length >= 3)
                {
                    if (int.TryParse(command[0].ToString(), out red) && int.TryParse(command[2].ToString(), out kolona) &&
                        red <= poleto.GetLength(0) && kolona <= poleto.GetLength(1))
                    {
                        command = "turn";
                    }
                }

                switch (command)
                {
                case "top":
                    klasacia(shampion4eta);
                    break;

                case "restart":
                    poleto  = create_igralno_pole();
                    bombite = slojibombite();
                    dumpp(poleto);
                    grum = false;
                    flag = false;
                    break;

                case "exit":
                    Console.WriteLine("4a0, 4a0, 4a0!");
                    break;

                case "turn":
                    if (bombite[red, kolona] != '*')
                    {
                        if (bombite[red, kolona] == '-')
                        {
                            tisinahod(poleto, bombite, red, kolona);
                            broya4++;
                        }

                        if (maks == broya4)
                        {
                            flag2 = true;
                        }
                        else
                        {
                            dumpp(poleto);
                        }
                    }
                    else
                    {
                        grum = true;
                    }

                    break;

                default:
                    Console.WriteLine("\nGreshka! nevalidna Komanda\n");
                    break;
                }

                if (grum)
                {
                    dumpp(bombite);
                    Console.Write("\nHrrrrrr! Umria gerojski s {0} to4ki. " + "Daj si niknejm: ", broya4);
                    string        niknejm = Console.ReadLine();
                    zaKlasiraneto t       = new zaKlasiraneto(niknejm, broya4);
                    if (shampion4eta.Count < 5)
                    {
                        shampion4eta.Add(t);
                    }
                    else
                    {
                        for (int i = 0; i < shampion4eta.Count; i++)
                        {
                            if (shampion4eta[i].Points < t.Points)
                            {
                                shampion4eta.Insert(i, t);
                                shampion4eta.RemoveAt(shampion4eta.Count - 1);
                                break;
                            }
                        }
                    }

                    shampion4eta.Sort((zaKlasiraneto r1, zaKlasiraneto r2) => r2.Name.CompareTo(r1.Name));
                    shampion4eta.Sort((zaKlasiraneto r1, zaKlasiraneto r2) => r2.Points.CompareTo(r1.Points));
                    klasacia(shampion4eta);

                    poleto  = create_igralno_pole();
                    bombite = slojibombite();
                    broya4  = 0;
                    grum    = false;
                    flag    = true;
                }

                if (flag2)
                {
                    Console.WriteLine("\nBRAVOOOS! Otvri 35 kletki bez kapka kryv.");
                    dumpp(bombite);
                    Console.WriteLine("Daj si imeto, batka: ");
                    string        imeee  = Console.ReadLine();
                    zaKlasiraneto to4kii = new zaKlasiraneto(imeee, broya4);
                    shampion4eta.Add(to4kii);
                    klasacia(shampion4eta);
                    poleto  = create_igralno_pole();
                    bombite = slojibombite();
                    broya4  = 0;
                    flag2   = false;
                    flag    = true;
                }
            }while (command != "exit");
            Console.WriteLine("Made in Bulgaria - Uauahahahahaha!");
            Console.WriteLine("AREEEEEEeeeeeee.");
            Console.Read();
        }