Exemplo n.º 1
0
        public GameScreen(GameEngine ge, Board p1, Board p2)
        {
            InitializeComponent();
            this.DoubleBuffered = true;
            this.MouseMove += new System.Windows.Forms.MouseEventHandler(Form_MouseMove);
            this.MouseClick += new System.Windows.Forms.MouseEventHandler(Form_MouseClick);

            this.ge = ge;
            this.p1 = p1;
            this.p2 = p2;
            boardSize = p1.getSize();
            shipListOne = p1.getShipList();
            shipListTwo = p2.getShipList();
            turn = ge.getTurn();
            phase = ge.getPhase();

            Console.WriteLine("Turn: " + turn + "  Phase: " + phase);
        }
Exemplo n.º 2
0
 public bool lost(Board p)
 {
     if (p.getShipList().Count() == 0)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Exemplo n.º 3
0
        //Place each ship
        void placeShipsPhase(Board p)
        {
            List<Ship> newShipList = new List<Ship>(p.getShipList());

            for (int i = 0; i < newShipList.Count; ++i)
            {
                if (!actionPlaceShip(p, newShipList.ElementAt(i)))
                {
                    --i;
                }
            }

            p.printBoard();
            Console.WriteLine("All ships placed, leaving phase");
            phase = 2;
        }