Example #1
0
        public void Play()
        {
            var playerTurn = _setup.Player1GoesFirst;

            bool playOn = true;

            while (playOn)
            {
                ShotStatus status = new ShotStatus();

                Console.Clear();

                if (playerTurn)
                {
                    status = FireShotPrompt(_setup.Player2Board, _setup.Player1Name);
                }

                else
                {
                    status = FireShotPrompt(_setup.Player1Board, _setup.Player2Name);
                }

                if (status == ShotStatus.Invalid || status == ShotStatus.Duplicate)
                {
                    playerTurn = !playerTurn;
                }

                playerTurn = !playerTurn;

                if (status != ShotStatus.Victory)
                {
                    playOn = true;
                }

                else
                {
                    playOn = false;

                    Console.WriteLine("Press ENTER to play again or press Q to quit.");

                    if (Console.ReadKey().Key == ConsoleKey.Q)
                    {
                        return;
                    }

                    else
                    {
                        SetupWorkflow restart = new SetupWorkflow();
                        restart.Start();
                    }
                }
            }
        }
Example #2
0
 internal void StartBattleship()
 {
     _setup.Start();
     Play();
 }
Example #3
0
        static void Main(string[] args)
        {
            SetupWorkflow tempSetup = new SetupWorkflow();

            tempSetup.Start();
        }