Esempio n. 1
0
        private void RozdejKarty()
        {
            ArrayList volnaPozice = new ArrayList();

            for (int y = 0; y < rozmer; y++)
            {
                for (int x = 0; x < rozmer; x++)
                {
                    Pozice pozice = new Pozice(x, y);
                    volnaPozice.Add(pozice);
                    PoleStavu[x, y] = StavKarty.Skryta;
                }
            }
            while (volnaPozice.Count >= 2)
            {
                Random generatorCisel = new Random();
                int    cislo          = generatorCisel.Next(volnaPozice.Count);
                Pozice prvniKarta     = (Pozice)volnaPozice[cislo];
                volnaPozice.Remove(prvniKarta);
                cislo = generatorCisel.Next(volnaPozice.Count);
                Pozice druhaKarta = (Pozice)volnaPozice[cislo];
                volnaPozice.Remove(druhaKarta);
                HerniPole[prvniKarta.X, prvniKarta.Y] = LicKarty;
                HerniPole[druhaKarta.X, druhaKarta.Y] = LicKarty;
                LicKarty++;
            }
        }
Esempio n. 2
0
 public void OtocPrvniKartu(int x, int y)
 {
     OtocenaKarta    = new Pozice(x, y);
     PoleStavu[x, y] = StavKarty.Otocena;
     PocitadloTahu++;
     VykresliPlochu();
 }