Exemplo n.º 1
0
        private void createBattleships()
        {
            int battleshipsArrayLength = 15;

            int lengthOfShipPlusNumberOfShipsInThisType = 6;

            for (int i = 5; i > 1; i--)
            {
                int j = lengthOfShipPlusNumberOfShipsInThisType - i;
                for (; j > 0; j--)
                {
                    myBattleships[battleshipsArrayLength - 1] = new Battleship(i);
                    battleshipsArrayLength--;
                }
            }
        }
Exemplo n.º 2
0
        public Point [] DrawRandomSpot(Battleship battleship) //losuj gdzie umieścić statek
        {
            Point[] randomPoints = DrawRandomPoints(battleship.length);


            for (int i = 0; i < randomPoints.Length; i++)
            {
                BlockLeftPoint(randomPoints[i]);
                BlockRightPoint(randomPoints[i]);
                BlockTopPoint(randomPoints[i]);
                BlockBottomPoint(randomPoints[i]);

                BlockTopLeftPoint(randomPoints[i]);
                BlockBottomLeftPoint(randomPoints[i]);
                BlockTopRightPoint(randomPoints[i]);
                BlockBottomRightPoint(randomPoints[i]);
            }

            return(randomPoints);
        }