public void detectHit(Point loc) { // Checks if the board was clicked if (loc.Y <= 300) { int x = 0; int y = 0; if (loc.X < 100) { x = 0; } else if (loc.X > 100 && loc.X < 200) { x = 1; } else if (loc.X > 200) { x = 2; } if (loc.Y < 100) { y = 0; } else if (loc.Y > 100 && loc.Y < 200) { y = 1; } else if (loc.Y > 200 && loc.Y < 300) { y = 2; } if (movesMade % 2 == 0) { GFX.drawX(new Point(x, y)); holders[x, y].setValue(X); if (detectRow()) { MessageBox.Show("You have won, X"); Xwins++; reset(); GFX.setUpCanvas(); } playersTurn = O; } else { GFX.drawO(new Point(x, y)); holders[x, y].setValue(O); if (detectRow()) { MessageBox.Show("You have won, O"); Owins++; reset(); GFX.setUpCanvas(); } playersTurn = X; } movesMade++; } }