private static void RecordPlayerShot(PlayerModel activePlayer, PlayerModel opponent)
        {
            bool   isValidShot = false;
            string row         = "";
            int    column      = 0;

            do
            {
                string shot = AskForShot(activePlayer);
                try
                {
                    (row, column) = GameLogic.SplitShotIntoRowAndColumn(shot);
                    isValidShot   = GameLogic.ValidateShot(activePlayer, row, column);
                }
                catch (Exception)
                {
                    // Console.WriteLine("This was not a valid Shot.Please try again");
                    isValidShot = false;
                }
                if (isValidShot == false)
                {
                    Console.WriteLine("Invalid shot. Please try again");
                }
            } while (isValidShot == false);

            bool isAHit = GameLogic.IdentifyShotResult(opponent, row, column);

            GameLogic.MarkShotResult(activePlayer, row, column, isAHit);
            DysplayShotResut(row, column, isAHit);
        }
Esempio n. 2
0
        private static void RecordPlayerShot(PlayerInfoModel activePlayer, PlayerInfoModel opponent)
        {
            bool   isValidShot = false;
            string row         = "";
            int    column      = 0;

            do
            {
                //Ask for a shot i.e. "B2" not "B" "2"
                string shot = AskForShot();
                //Determine what row and column
                (row, column) = GameLogic.SplitShotIntoRowAndColumn(shot);
                isValidShot   = GameLogic.ValidateSpot(activePlayer, row, column);
                if (isValidShot == false)
                {
                    Console.WriteLine("Invalid shot location. Try again.");
                }
            } while (isValidShot == false);
            bool isAHit = GameLogic.IdentifyShotResult(opponent, row, column);

            GameLogic.MarkShotResult(activePlayer, row, column, isAHit);
        }