Exemple #1
0
        private void HratHru()
        {
            if (Hrac.MaPravoPrvnihoTahu())
            {
                CilTahu      = Hrac.RozhodnoutVlastniTah();
                VysledekTahu = Hrac.ZjistitVysledekTahu(Souper, CilTahu);

                Hrac.ProvestVlastniTah(CilTahu, VysledekTahu);
            }

            while (!HraSkoncila())
            {
                CilTahu      = Hrac.ZjistitTahSoupere();
                VysledekTahu = Hrac.ProvestTahSoupere(CilTahu);

                Hrac.OznamitVysledekTahu(Souper, VysledekTahu);

                if (HraSkoncila())
                {
                    break;
                }

                CilTahu      = Hrac.RozhodnoutVlastniTah();
                VysledekTahu = Hrac.ZjistitVysledekTahu(Souper, CilTahu);

                Hrac.ProvestVlastniTah(CilTahu, VysledekTahu);
            }
        }
Exemple #2
0
        public Hra()
        {
            foreach (IPAddress adr in Dns.GetHostAddresses(Dns.GetHostName()))
            {
                if (adr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                {
                    MistniIP = adr;
                    break;
                }
            }

            Hrac = new LidskyHrac(MistniIP);
        }
Exemple #3
0
 private void VyhlasitVysledky()
 {
     if (Hrac.JeVitezem())
     {
         Console.WriteLine("Vítězství!");
     }
     else if (Hrac.JePorazenym())
     {
         Console.WriteLine("Porážka...");
     }
     else if (Hrac.NemuzeProvestDalsiTah())
     {
         Console.WriteLine("Remíza.");
     }
 }
Exemple #4
0
        private void NastavitHrace()
        {
            if (BudeSeHratProtiPocitaci())
            {
                Souper = new PocitacovyHrac();

                Souper.NastavitAdresuSoupere(Hrac.VlastniAdresa);
                Hrac.NastavitAdresuSoupere(Souper.VlastniAdresa);

                VlaknoProAI = OddelitDoSamostatnehoVlakna(HratHru);
                VlaknoProAI.Start(Souper);
            }
            else
            {
                OznamitMistniAdresu();

                Hrac.NastavitAdresuSoupere(ZjistitAdresuSoupere());
            }
        }
Exemple #5
0
        private void NastavitHrace()
        {
            if (HrajeSeProtiAI())
            {
                Souper = new PocitacovyHrac();

                Hrac.NastavitAdresuSoupere(Souper.Prijimac.Address);
                Souper.NastavitAdresuSoupere(Hrac.Prijimac.Address);

                ((PocitacovyHrac)Souper).OddelitDoSamostatnehoVlakna();
            }
            else
            {
                OznamitMistniAdresu();
                Hrac.NastavitAdresuSoupere(ZjistitAdresuSoupere());
            }

            Hrac.RozmistitLode();
        }
Exemple #6
0
        private void NastavitHrace()
        {
            if (((TextoveRozhrani)Rozhrani).Menu.HraProtiPocitaci)
            {
                Souper = new PocitacovyHrac();

                Souper.NastavitAdresuSoupere(Hrac);
                Hrac.NastavitAdresuSoupere(Souper);


                Souper.NastavitAdresuSoupere(Hrac);
                Hrac.NastavitAdresuSoupere(Souper);


                VlaknoProAI = OddelitDoSamostatnehoVlakna(HratHru);
                VlaknoProAI.Start(Souper);
            }
            else
            {
                OznamitMistniAdresu();

                Hrac.NastavitAdresuSoupere(ZjistitAdresuLidskehoSoupere());
            }
        }
Exemple #7
0
 private bool HraSkoncila()
 {
     return(Hrac.JePorazenym() || Hrac.JeVitezem() || Hrac.NemuzeProvestDalsiTah());
 }