What's wrong with my recursive function?
<p>So I'm trying to implement a recursive function that generates the entire game tree of Tic-Tac-Toe, and I can't seem to get it to work.</p>

<pre><code>   void BuildTree(Node&amp; nNode, const int&amp; nextPlayer)
    {
        //Copy last board
        Ticboard tBoard = nNode.m_board;
        do
        {
//Return first valid move
            int validMove = tBoard.FirstValidMove();
            if (validMove != -1)
            {
                Node f;
                Ticboard tempBoard = nNode.m_board;
                tempBoard.Move(validMove, nextPlayer);
                tBoard.Move(validMove, nextPlayer);
                f.m_board = tempBoard;
                f.m_winCount = 0;
                nNode.m_branches.push_back(f);
                int currPlay = (nextPlayer == 1 ? 2 : 1);
                BuildTree(f,currPlay);
            }
            else
            {
                break;
            }
        }while(true);
    }
</code></pre>

<p>The actual function works, I've gone through and debugged it and it SHOWS it working as it is supposed to, but when I look at the nodes generated (for Tic-Tac-Toe, by the way) in Visual Studios via breakpoint, it only shows the first 9 branches.  I know more were generated because it takes a few seconds, and I added a counter.</p>

<p>Here's how I call the code:</p>

<pre><code>    Ticboard lol;
Node startTree;
startTree.m_board = lol;
int startPlay = 1;
BuildTree(startTree, startPlay);
</code></pre>

<p>Without copying all my code for bitboards and whatnot in here, can you see anything immediately wrong with the logic?</p>
