private void SetAiShipVisibility()
 {
     if (ShowAiShips)
     {
         var fleet = AiFleet.GetFleet();
         for (var ship = 0; ship < 5; ship++)
         {
             var s = fleet[ship];
             if (s == null)
             {
                 continue;
             }
             if (s.IsVertical)
             {
                 AIShipVerticalVisibility[ship] = true;
             }
             else
             {
                 AIShipHorizontalVisibility[ship] = true;
             }
         }
     }
     else
     {
         for (var ship = 0; ship < 5; ship++)
         {
             AIShipHorizontalVisibility[ship] = false;
             AIShipVerticalVisibility[ship]   = false;
         }
     }
 }
        private void PlayerCellClicked(int cell)
        {
            if (GameState != GameState.HumansTurn)
            {
                return;
            }

            var x            = cell % 10;
            var y            = cell / 10;
            var attackedCell = new Coordinate(x, y);

            _captain.OpponentAttack(attackedCell);
            var result = AiFleet.Attacked(attackedCell);

            PlayerGameBoard[x][y] = result;

            if (result == Constants.Defeated)
            {
                MessageBox.Show("You win!");
                AILosses++;
                GameState = GameState.Waiting;
                return;
            }
            GameState = GameState.AIsTurn;

            var aiAttack = _captain.MakeAttack();

            result = PlayerFleet.Attacked(aiAttack);
            _captain.ResultOfAttack(result);

            AIGameBoard[aiAttack.X][aiAttack.Y] = result;

            if (result == Constants.Defeated)
            {
                MessageBox.Show("You lose :(");
                AIWins++;
                GameState = GameState.Waiting;
                return;
            }
            GameState = GameState.HumansTurn;
        }