private async void gameBoard_MouseUp(object sender, MouseEventArgs e) { int ColWidth = gameBoard.Width / gameBoard.NCOLS; int ColClicked; // Detect in which col is clicked for (int n = 0; n < gameBoard.Width; n += ColWidth) { if (e.X > n && e.X < n + ColWidth) { ColClicked = n / ColWidth; GameFlow.PlayerMove(ColClicked); gameBoard.GameBoard = GameFlow.Game.Board; gameBoard.Invalidate(); } } // Fake CPU 'thinking' if (!cbFastCPUMoves.Checked) { await Task.Delay(new Random().Next(500, 1000)); } GameFlow.Continue(); gameBoard.Refresh(); }