예제 #1
0
        static bool muzeSeOtocit(Souradnice souradnice, NatoceniLode uhel, TypLode lod)
        {
            if (lod == TypLode.Clun)
            {
                if (uhel == NatoceniLode.Stupnu0)
                {
                    if (souradnice.X >= 0 || souradnice.Y + 1 <= herniPoleY.Length || souradnice.X <= herniPoleX.Length || souradnice.Y > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                if (uhel == NatoceniLode.Stupnu90)
                {
                    if (souradnice.X >= 0 || souradnice.Y <= herniPoleY.Length || souradnice.X + 1 <= herniPoleX.Length || souradnice.Y > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (uhel == NatoceniLode.Stupnu180)
                {
                    if (souradnice.X >= 0 || souradnice.Y + 1 <= herniPoleY.Length || souradnice.X <= herniPoleX.Length || souradnice.Y > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                if (uhel == NatoceniLode.Stupnu270)
                {
                    if (souradnice.X >= 0 || souradnice.Y <= herniPoleY.Length || souradnice.X + 1 <= herniPoleX.Length || souradnice.Y > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
예제 #2
0
 public StavPolicka ProvestTahSoupere(Souradnice tah)
 {
     if (HerniPole[tah.X, tah.Y] == StavPolicka.Lod)
     {
         HerniPole[tah.X, tah.Y] = StavPolicka.Zasah;
         return(StavPolicka.Zasah);
     }
     else
     {
         HerniPole[tah.X, tah.Y] = StavPolicka.Mimo;
         return(StavPolicka.Mimo);
     }
 }
예제 #3
0
 public bool BlokujePolicko(Souradnice souradnice, NatoceniLode uhel)
 {
     foreach (var policko in Policka)
     {
         if (policko.X >= herniPoleX.Length || policko.X <= 0 || policko.Y >= herniPoleY.Length || policko.Y <= 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     return(false);
 }
예제 #4
0
        public bool JeUmistenaSpravne(Souradnice rozmerHernihoPole, List <Lod> ostatniLode)
        {
            foreach (var lod in ostatniLode)
            {
                foreach (var policka in lod.Policka)
                {
                    foreach (var lokalniPolicka in Policka)
                    {
                        if (lokalniPolicka == policka)
                        {
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
            }

            throw new NotImplementedException();
        }
예제 #5
0
        public StavPolicka ZjistitVysledekTahuOdSoupere(Souradnice DataSouradnice)
        {
            BitConverter.GetBytes(DataSouradnice.X);
            BitConverter.GetBytes(DataSouradnice.Y);
            byte[] SouradniceX = new byte[100];
            byte[] SouradniceY = new byte[100];

            Socket postak = VysilaciKomunikacniKanal;

            postak.Send(SouradniceX);
            postak.Send(SouradniceY);

            postak = PrijimaciKomunikacniKanal;

            byte[] jakToDopadlo = new byte[100];
            postak.Receive(jakToDopadlo);

            int         vysledekJakoInt         = BitConverter.ToInt32(jakToDopadlo, startIndex);
            StavPolicka vysledekJakoStavPolicka = (StavPolicka)vysledekJakoInt;

            return(vysledekJakoStavPolicka);
        }
예제 #6
0
 public void VykomunikovatTahSoupere(Souradnice tah, StavPolicka vysledek)
 {
     throw new NotImplementedException();
 }
예제 #7
0
 public StavPolicka ProvestTahSoupere(Souradnice tah)
 {
     throw new System.NotImplementedException();
 }
예제 #8
0
 public void ProvestVlastniTah(Souradnice tah, StavPolicka vysledek)
 {
     throw new NotImplementedException();
 }
예제 #9
0
 public StavPolicka ZjistitVysledekTahuOdProtihrace(Souradnice tah)
 {
     throw new System.NotImplementedException();
 }
예제 #10
0
 public void Premistit(Souradnice souradnice, NatoceniLode natoceni)
 {
 }
예제 #11
0
 public void ZobrazitZamerovac(Souradnice souradnice, Souradnice rozsahZobrazeni, StavPolicka zpusobZobrazeni)
 {
     throw new NotImplementedException();
 }
예제 #12
0
 public void ZobrazitLod(Lod lod, Souradnice rozsahZobrazeni, StavPolicka zpusobZobrazeni)
 {
     throw new NotImplementedException();
 }
예제 #13
0
 public StavPolicka ZjistitVysledekTahuOdSoupere(Souradnice tah)
 {
     throw new NotImplementedException();
 }
예제 #14
0
 public void Premistit(Souradnice souradnice, NatoceniLode natoceni)
 {
     throw new NotImplementedException();
 }
예제 #15
0
 public void Posunout(int dx, int dy, Souradnice rozsahPohybu)
 {
     throw new NotImplementedException();
 }
예제 #16
0
 public bool JeUmistenaSpravne(Souradnice rozmerHernihoPole, List <Lod> ostatniLode)
 {
     throw new NotImplementedException();
 }
예제 #17
0
 public bool BlokujePolicko(Souradnice souradnice)
 {
     throw new NotImplementedException();
 }
예제 #18
0
 public void ProvestVlastniTah(Souradnice tah, StavPolicka vysledek)
 {
     HerniPoleSoupere[tah.X, tah.Y] = vysledek;
 }
예제 #19
0
        public void Posunout(int dx, int dy, Souradnice souradnice, NatoceniLode uhelNatoceni)
        {
            if (Typ == TypLode.Clun)
            {
                if (uhelNatoceni == NatoceniLode.Stupnu0)
                {
                    switch (Console.ReadKey(true).KeyChar)
                    {
                    case 'd':
                        if (souradnice.X <= herniPoleX.Length - 3)
                        {
                            Souradnice.X++;
                            Console.Clear();
                        }
                        break;

                    case 's':
                        if (souradnice.Y <= herniPoleY.Length - 2)
                        {
                            souradnice.Y++;
                            Console.Clear();
                        }
                        break;

                    case 'w':

                        if (souradnice.Y > 0 || souradnice.Y == herniPoleY.Length - 1)
                        {
                            souradnice.Y--;
                            Console.Clear();
                        }
                        break;

                    case 'a':
                        if (souradnice.X > 0 || souradnice.X == herniPoleX.Length - 1)
                        {
                            Souradnice.X--;
                            Console.Clear();
                        }
                        break;
                    }
                }

                if (uhelNatoceni == NatoceniLode.Stupnu90)
                {
                    switch (Console.ReadKey(true).KeyChar)
                    {
                    case 'd':
                        if (souradnice.X <= herniPoleX.Length - 2)
                        {
                            souradnice.X++;
                            Console.Clear();
                        }
                        break;

                    case 's':
                        if (souradnice.Y <= herniPoleY.Length - 3)
                        {
                            souradnice.Y++;
                            Console.Clear();
                        }
                        break;

                    case 'w':

                        if (souradnice.Y > 0 || souradnice.Y == herniPoleY.Length - 1)
                        {
                            souradnice.Y--;
                            Console.Clear();
                        }
                        break;

                    case 'a':
                        if (souradnice.X > 0 || souradnice.X == herniPoleX.Length)
                        {
                            souradnice.X--;
                            Console.Clear();
                        }
                        break;
                    }
                }
                if (uhelNatoceni == NatoceniLode.Stupnu180)
                {
                    switch (Console.ReadKey(true).KeyChar)
                    {
                    case 'd':
                        if (souradnice.X <= herniPoleX.Length - 3)
                        {
                            souradnice.X++;
                            Console.Clear();
                        }
                        break;

                    case 's':
                        if (souradnice.Y <= herniPoleY.Length - 2)
                        {
                            souradnice.Y++;
                            Console.Clear();
                        }
                        break;

                    case 'w':

                        if (souradnice.Y > 0 || souradnice.Y == herniPoleY.Length - 1)
                        {
                            souradnice.Y--;
                            Console.Clear();
                        }
                        break;

                    case 'a':
                        if (souradnice.X > 0 || souradnice.X == herniPoleX.Length - 1)
                        {
                            souradnice.X--;
                            Console.Clear();
                        }
                        break;
                    }
                }
                if (uhelNatoceni == NatoceniLode.Stupnu270)
                {
                    switch (Console.ReadKey(true).KeyChar)
                    {
                    case 'd':
                        if (souradnice.X <= herniPoleX.Length - 2)
                        {
                            souradnice.X++;
                            Console.Clear();
                        }
                        break;

                    case 's':
                        if (souradnice.Y <= herniPoleY.Length - 3)
                        {
                            souradnice.Y++;
                            Console.Clear();
                        }
                        break;

                    case 'w':

                        if (souradnice.Y > 0 || souradnice.Y == herniPoleY.Length - 2)
                        {
                            souradnice.Y--;
                            Console.Clear();
                        }
                        break;

                    case 'a':
                        if (souradnice.X > 0 || souradnice.X == herniPoleX.Length)
                        {
                            souradnice.X--;
                            Console.Clear();
                        }
                        break;
                    }
                }
            }
        }
예제 #20
0
 public bool ZasahujeNaPolicko(Souradnice policko)
 {
     throw new NotImplementedException();
 }
예제 #21
0
 public StavPolicka ZjistitVysledekTahu(ObecnyHrac souper, Souradnice tah)
 {
     throw new System.NotImplementedException();
 }