public void move(int x, int y) //move function for acting { if (steps % 2 == 0) //X's turn { if (holders[x, y].getValue() != O) { GraphicsPart.drawX(new Point(x, y)); holders[x, y].setValue(X); steps++;//with every click increment moves turn = O; if (detectRow()) { MessageBox.Show("X has won!"); winner = X; reset(); } } } else //O's turn { if (holders[x, y].getValue() != X) { GraphicsPart.drawO(new Point(x, y)); holders[x, y].setValue(O); steps++;//with every click increment moves turn = X; if (detectRow()) { MessageBox.Show("O has won!"); winner = O; reset(); } } } if (steps == 9 && detectRow() == false) //DRAW { MessageBox.Show("It's a draw!"); winner = B; reset(); } }