Ejemplo n.º 1
0
 // TODO: order of constructors is too restricting... fix me!
 public BatteShipGame(IPlayer cpu, IPlayer humanOrCpu, Coordinate boardDims, ShipPlacementHelper sph, GameInfoHelper gih)
 {
     this.maxCoords = boardDims; // ex) 10 x 10 board would have maxCoord of 9, 9
     this.sph = sph;
     this.gih = gih;
     this.A = cpu;
     this.B = humanOrCpu;
     this.A.Initialize(maxCoords, gih.GetStartingShips());
     this.B.Initialize(maxCoords, gih.GetStartingShips());
 }
Ejemplo n.º 2
0
        public void Initialize(Coordinate maxCoords, Ship[] startingShips)
        {
            this.Ships = startingShips;
            this.MaxCoords = maxCoords;
            this.Attacks = new Attack[maxCoords.X + 1, maxCoords.Y + 1];
            for (int x = 0; x <= maxCoords.X; x++) { for (int y = 0; y <= maxCoords.Y; y++) { Attacks[x, y] = new Attack(); } }
            this.sph = new ShipPlacementHelper(maxCoords);
            this.gih = new GameInfoHelper();

            this.resetShips.IsEnabled = false;
            this.resetShips.Visibility = Visibility.Hidden;

            InitializeGrids();
            InitializeShips();
            InitializePlayerInfo();
        }