Hi all, I am attempting to write a neural-network backed program that will learn and play checkers. Everything has been going peachy so far, but when I decided to implement an Alpha-Beta search algorithm, i realized that I needed a function to look at all possible moves at a certain point in the game. I thought that using recursion would be the best way to do this, since you need to go through every possible move on the board. I also wanted to return the board state (represented as a 1d array), but that is where i ran into a problem.

Code:
//returnAllPosMoves fnc
	//****UNDER CONSTRUCTION****\\
	//returns every possible board position at point in game.
	//@ turn:	bool to determin turn; true = red, false = black.
	int *returnAllPosMoves(bool turn, int placeInLookUp)
	{
		int V = 0;
		int i = placeInLookUp;
		bool off;

		//BASE CASE: i==40
		if(i==40)
			return boardRep;

		//CASE: red turn
		else if(turn == true)
		{
			//is offset
			if(rowOffset(i))
			{
				//check move one
				if(V=validMove(i,i+4,true) == 1)
				{
					move(i,i+4);
					return boardRep;
				}
				//check move two
				if(V=validMove(i,i+5,true) == 1)
				{
					move(i,i+5);
					return boardRep;
				}
					
			}
			//not offset
			else
			{
				//check move one
				if(V=validMove(i,i+5,true) == 1)
				{
					move(i,i+5);
					return boardRep;
				}
				//check move two
				if(V=validMove(i,i+6,true) == 1)
				{
					move(i,i+6);
					return boardRep;
				}
			}
		}

		//CASE: black turn
		else
		{
			//is offset
			if(rowOffset(i))
			{
				//check move one
				if(V=validMove(i,i-6,false) == 1)
				{
					move(i,i-6);
					return boardRep;
				}
				//check second move
				if(V=validMove(i,i-5,false) == 1)
				{
					move(i, i-5);
					return boardRep;
				}
			}
			//not offset
			else
			{
				//check move one
				if(V=validMove(i,i-5,false) == 1)
				{
					move(i,i-5);
					return boardRep;
				}
				//check second move
				if(V=validMove(i,i-4,false) == 1)
				{
					move(i, i-4);
					return boardRep;
				}
			}
		}
	}
The problem is that I am not sure where to put the recursion. Since hitting a return statement exits a function, I figure it should be beforehand, but then it would never finish. Anybody have any ideas to help me out?

PS. move() and validMove() are functions i built in; the move() fnc moves a piece, and validMove() checks to make sure the move is not out of bounds/moving on another peice.