Esempio n. 1
0
 //constr
 public AIPlayer(int playerNumber, int size)
 {
     rng              = new Random();
     BoardSize        = size;
     PlayerNumber     = playerNumber;
     MyBoard          = new Board(true, size);
     MyEnemyBoard     = new Board(false, size);
     MyShips          = new List <Ship>();
     ShipsIveSunk     = new List <Ship>();
     LastShipsIveSunk = new List <Ship> {
     };
     MyDestroyer      = new Destroyer(PlayerNumber);
     MyShips.Add(MyDestroyer);
     MySub = new Submarine(PlayerNumber);
     MyShips.Add(MySub);
     MyBattleship = new Battleship(PlayerNumber);
     MyShips.Add(MyBattleship);
     MyCarrier = new Carrier(PlayerNumber);
     MyShips.Add(MyCarrier);
     MyBoard.FillBoard();
     MyEnemyBoard.FillBoard();
     HasUnplacedShips  = true;
     HasShipsAfloat    = true;
     LastGuess         = new int[2];
     PreviousLastGuess = new int[2];
     if (PlayerNumber == 1)
     {
         DesyncRandoms();
     }
 }
Esempio n. 2
0
        //MembVars

        //Constr
        public HumanPlayer(int playerNumber, int size)
        {
            PlayerNumber = playerNumber;
            BoardSize    = size;
            MyBoard      = new Board(true, size);
            MyEnemyBoard = new Board(false, size);
            MyShips      = new List <Ship>();
            ShipsIveSunk = new List <Ship>();
            MyDestroyer  = new Destroyer(PlayerNumber);
            MyShips.Add(MyDestroyer);
            MySub = new Submarine(PlayerNumber);
            MyShips.Add(MySub);
            MyBattleship = new Battleship(PlayerNumber);
            MyShips.Add(MyBattleship);
            MyCarrier = new Carrier(PlayerNumber);
            MyShips.Add(MyCarrier);
            MyBoard.FillBoard();
            MyEnemyBoard.FillBoard();
            HasUnplacedShips = true;
            HasShipsAfloat   = true;
        }