OK, If I understand the question correctly, you are basically wanting to create an "Un-DO" button, that will take you back to before the LAST move?
Create another partial class that stores each move.
Then set the LastMove details after each move.
Then, you can go back to those values!
Maybe not the way someone else would do it, but I would try something like this.
public partial class Form1 : Form
{
double q = 0;
bool turn = true;
int turn_count = 0;
public LastMove lMove = new LastMove();
public Form1()
{
InitializeComponent();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
public void button_click(object sender, EventArgs e)
{
Button b = (Button)sender;
if (turn)
b.Text = "X";
else
b.Text = "O";
b.Enabled = false;
turn_count++;
lMove.turn = turn;
lMove.button = b;
lMove.tCount = turn_count;
turn = !turn;
}
public void UnDo_Button_click(object sender, EventArgs e)
{
turn = !turn;
lMove.button.Text = "";
lMove.button.Enabled = true;
}
}
public partial class LastMove
{
public bool turn { get; set; }
public Button button { get; set; }
public int tCount { get; set; }
}