Example #1
0
        public void RuchAutomatyczny(Gracz otherPlayer)
        {
            bool takenShot = false;

            while (!takenShot)
            {
                int row = rnd.Next(RozmiarPola);
                int col = rnd.Next(RozmiarPola);

                if (PolePrzeciwnika[row][col].Type == RodzajPola.Nieznane)
                {
                    Strzal(row, col, otherPlayer);
                    takenShot = true;
                }
            }
        }
Example #2
0
        protected void Strzal(int row, int col, Gracz otherPlayer)
        {
            int        damagedIndex;
            bool       zatopiony;
            RodzajPola newType = otherPlayer.Strzal(row, col, out damagedIndex, out zatopiony);

            PolePrzeciwnika[row][col].ShipIndex = damagedIndex;

            if (zatopiony)
            {
                ZatopionyKompa(damagedIndex);
            }
            else
            {
                PolePrzeciwnika[row][col].Type = newType;
            }
        }
Example #3
0
 public void RuchGracza(Gracz otherPlayer)
 {
     RuchAutomatyczny(otherPlayer);
 }
Example #4
0
 public void RuchGracza(int row, int col, Gracz otherPlayer)
 {
     Strzal(row, col, otherPlayer);
 }