C# - If/Else Help [User and Computer Input Interaction]
<p>I am trying to figure out a way to get the Computer player to respond to my moves basically by seeing "This spot is taken, I should see if another is free and take it".</p>

<p>So far, I'm not making any improvements (been like 5 hours). I want the computer to realize if a certain button (which it chose at random) is taken, it should consider another choice. Not sure where the if/else should actually go or where/what I should put in for it to try another location.</p>

<p>Here's the snippet of code with comments on my idea (likely wrong placement where I want to do things):</p>

<pre><code>if (c.Enabled == true) //if the button is free
{
    if ((c.Name == "btn" + Convert.ToString(RandomGenerator.GenRand(1, 9)) )) //if a specific button is free
    {
        if ((c.Text != "X")) //if its empty
        {
            //do this
            c.Text = "O"; //O will be inside the button
            c.Enabled = false; //button can no long be used
            CheckComputerWinner(); //check if it finishes task
            return;
        }
        else //if it is an X
        {
            //try a different button choice instead
            //see if that button is empty
                //do stuff
            //else
                //... repeat until all buttons are checked if free
        }
    }
}
</code></pre>

<p>My question is simply: How can I fix this and understand what is going on? Or do it more efficiently?</p>
