Exemplo n.º 1
0
        public override int[] GetFirstCoord(string name, int shipLength)
        {
            int rowIndex;
            int columnIndex;

            do
            {
                rowIndex    = RandNumGen.GenerateRand(0, 20);
                columnIndex = RandNumGen.GenerateRand(0, 20);
            } while (!FirstCoordinateValidation(rowIndex, columnIndex, shipLength));

            int[] firstCoordinates = new int[2] {
                rowIndex, columnIndex
            };
            return(firstCoordinates);
        }
Exemplo n.º 2
0
        public void Run()
        {
            List <string> startOptions = new List <string> {
                "Play single player", "Play multiplayer", "Spectator Mode(Comp vs Comp)"
            };
            ConsoleOptionsInterface startMenu = new ConsoleOptionsInterface(startOptions, true, false);
            bool runGame = true;

            while (runGame == true)
            {
                int optionSelected = startMenu.Launch();//If optionSelected == 4, program automatically terminated.
                playersList = Setup.LoadBattleConsoles(optionSelected);
                playerOne   = playersList[0];
                playerTwo   = playersList[1];
                playerOne.SetBoard();
                playerTwo.SetBoard();
                TurnCycle(RandNumGen.GenerateRand(0, 2));
            }
        }
Exemplo n.º 3
0
        public override int GetCorrespondingOrientationNum(int[] firstCoordinate)
        {
            int randomOrientationNumber = RandNumGen.GenerateRand(1, 5);

            return(randomOrientationNumber);
        }