I am working on the tic tac toe problem and i need help with the AI part i got it to work for 1v1 but it needs to be 1vAI
I was thinking that easiest was to to program something like "when player clicks this squaure, AI will click anything"
Should I create another temp button then everytime
tempbutton is used make tempbutton2 also move?
Belowe is the code for the clickhandler part
Thanks
private void ClickHandler(object sender, System.EventArgs e)
{
Button tempButton = (Button)sender;
if( this._isGameOver )
{
MessageBox.Show("please start new game!","Game End",MessageBoxButtons.OK);
return;
}
if( tempButton.Text != "" )
{
return;
}
if( _isX )
tempButton.Text = "X";
else
tempButton.Text = "O";
_isX = !_isX;
this._isGameOver = result.CheckWinner(_buttonArray );
}
}