private void Button_Click(object sender, EventArgs e) { var btn = (Button)sender; var cord = (int[])btn.Tag; var res = logic.SetPlayer(btn, cord); ShowMessage(res); if (!logic.PlayerOneWalk && res == ResType.Nothing) { cord = AILogic.CordAI(logic, XOType.O, logic.Field); foreach (var cntrl in gameBoard.Controls) { if (cntrl is Button btnAI) { var btnCord = (int[])btnAI.Tag; if (btnCord[0] == cord[0] && btnCord[1] == cord[1]) { ShowMessage(logic.SetPlayer(btnAI, cord)); } } } } }