// player 2 take shot private void button4_Click(object sender, EventArgs e) { // click on your own board to take shot at opponent int rowindex = Board2.SelectedCells[0].RowIndex; int columnindex = Board2.SelectedCells[0].ColumnIndex; var is_shot_hit = player1.takeshot(rowindex, columnindex); if (!is_shot_hit) { // give chance to the other player as it is a miss button3.Enabled = true; button4.Enabled = false; } else // if hit check if all ships sunked { if (player1.checksunkShips()) { button4.Enabled = false; gameResult.Text = "All ships of Player 1 sanked and Player 2 has won"; } } setGrid(player1, Board1); }