public void ComputerHitOrMiss()
        {
            int[] shoot = MyGameEngine.ComputerRandomShotFired();

            if (WasCloseToShip == false && ComputerHitShip == false && MyGameEngine.CheckIfAPlayerShipHasBeenHit() == false)
            {
                if (MyGameEngine.ComputerCheckHitOrMiss(shoot[0], shoot[1]))
                {
                    foreach (var myPlayerButton in PlayerButtonsInGame)
                    {
                        if (myPlayerButton.Longitude == shoot[0] && myPlayerButton.Latitude == shoot[1])
                        {
                            CoordinatesHitShip       = new int[] { shoot[0], shoot[1] };
                            myPlayerButton.HitOrMiss = "Träff!";
                            ChangeGridSquareToExplosionImage(myPlayerButton);
                            ComputerHitShip          = true;
                            myPlayerButton.IsClicked = true;
                        }
                    }
                    if (MyGameEngine.PlayerHasLost())
                    {
                        MyGameEngine.AddNewHighscore(false, Global.MyPlayer.Id);
                        ShowLosingDialogueBox();
                    }
                    ChangePlayerTurn();
                }
                else if (MyGameEngine.ComputerCheckCloseOrNot(shoot[0], shoot[1]))
                {
                    CoordinatesCloseToShip = new int[] { shoot[0], shoot[1] };
                    AddCloseOnPlayerBoard(shoot[0], shoot[1]);
                }
                else
                {
                    foreach (var myPlayerButton in PlayerButtonsInGame)
                    {
                        if (myPlayerButton.Longitude == shoot[0] && myPlayerButton.Latitude == shoot[1])
                        {
                            myPlayerButton.HitOrMiss = "Miss!";
                            ChangeToSplashImage(myPlayerButton);
                            myPlayerButton.IsClicked = true;
                        }
                    }
                    ChangePlayerTurn();
                }
            }
            else if (WasCloseToShip == true && ComputerHitShip == false && MyGameEngine.CheckIfAPlayerShipHasBeenHit() == false)
            {
                ComputerShootAroundSplashSonar();
            }
            else if (ComputerHitShip == true && MyGameEngine.CheckIfAPlayerShipHasBeenHit() == false)
            {
                ComputerShootToSinkShip(CoordinatesHitShip);
            }
            else if (MyGameEngine.CheckIfAPlayerShipHasBeenHit() == true)
            {
                ShootCloseToAShipAlreadyHit();
            }
        }
        public void ShootCloseToAShipAlreadyHit()
        {
            int[] shot = MyGameEngine.GetCoordinatesOfPlayerShipAlreadyHit();

            if (MyGameEngine.ComputerCheckIfShipStillFloating(shot[0], shot[1]) == true)
            {
                int[] newShot = MyGameEngine.ComputerShootToSinkShip(shot[0], shot[1]);

                if (MyGameEngine.ComputerCheckHitOrMiss(newShot[0], newShot[1]))
                {
                    foreach (var myPlayerButton in PlayerButtonsInGame)
                    {
                        if (myPlayerButton.Longitude == newShot[0] && myPlayerButton.Latitude == newShot[1])
                        {
                            myPlayerButton.HitOrMiss = "Träff!";
                            CoordinatesHitShip       = new int[] { shot[0], shot[1] };
                            ChangeGridSquareToExplosionImage(myPlayerButton);
                            myPlayerButton.IsClicked = true;
                            WasCloseToShip           = false;
                        }
                    }
                    if (MyGameEngine.PlayerHasLost())
                    {
                        MyGameEngine.AddNewHighscore(false, Global.MyPlayer.Id);
                        ShowLosingDialogueBox();
                    }
                    ChangePlayerTurn();
                }
                else if (MyGameEngine.ComputerCheckCloseOrNot(newShot[0], newShot[1]))
                {
                    AddCloseOnPlayerBoard(newShot[0], newShot[1]);
                }
                else
                {
                    foreach (var myPlayerButton in PlayerButtonsInGame)
                    {
                        if (myPlayerButton.Longitude == newShot[0] && myPlayerButton.Latitude == newShot[1])
                        {
                            myPlayerButton.HitOrMiss = "Miss!";
                            ChangeToSplashImage(myPlayerButton);
                            myPlayerButton.IsClicked = true;
                        }
                    }
                    ChangePlayerTurn();
                }
            }
            else if (MyGameEngine.ComputerCheckIfShipStillFloating(shot[0], shot[1]) == false)
            {
                ComputerHitShip = false;
                ComputerHitOrMiss();
            }
        }
        private void ComputerShootAroundSplashSonar()
        {
            int[] shoot = MyGameEngine.ComputerShotCloseToSplashSonar(CoordinatesCloseToShip[0], CoordinatesCloseToShip[1]);

            if (MyGameEngine.ComputerCheckHitOrMiss(shoot[0], shoot[1]))
            {
                foreach (var myPlayerButton in PlayerButtonsInGame)
                {
                    if (myPlayerButton.Longitude == shoot[0] && myPlayerButton.Latitude == shoot[1])
                    {
                        myPlayerButton.HitOrMiss = "Träff!";
                        CoordinatesHitShip       = new int[] { shoot[0], shoot[1] };
                        ChangeGridSquareToExplosionImage(myPlayerButton);
                        myPlayerButton.IsClicked = true;
                        WasCloseToShip           = false;
                        ComputerHitShip          = true;
                    }
                }
                if (MyGameEngine.PlayerHasLost())
                {
                    MyGameEngine.AddNewHighscore(false, Global.MyPlayer.Id);
                    ShowLosingDialogueBox();
                }
                ChangePlayerTurn();
            }
            else if (MyGameEngine.ComputerCheckCloseOrNot(shoot[0], shoot[1]))
            {
                AddCloseOnPlayerBoard(shoot[0], shoot[1]);
            }
            else
            {
                foreach (var myPlayerButton in PlayerButtonsInGame)
                {
                    if (myPlayerButton.Longitude == shoot[0] && myPlayerButton.Latitude == shoot[1])
                    {
                        myPlayerButton.HitOrMiss = "Miss!";
                        ChangeToSplashImage(myPlayerButton);
                        myPlayerButton.IsClicked = true;
                    }
                }
                ChangePlayerTurn();
            }
        }