C++ alpha-beta-pruining

So here's some alpha-beta pseudocode that I'm doing for the Fif game that I'm making of me vs. computer (VERY similar to tic tac toe) I'm working on the 3rd line of it "child= ...." Basically I'm trying to make vector of boards with each child board representing each possible state of the game of the next move. For example. If the board is:

1 2 3 4 5 6 7 8 9
X O
An example of a child board:
1 2 3 4 5 6 7 8 9 OR 1 2 3 4 5 6 7 8 9 etc.
X X O X X O

Every move possible that's not used will be stored as a child board.

Again, here's the pseudocode for the alpha-beta function that I found and the next function is my start/attempt to complete the "child=... " task . If I could get some guidance that would be great!


/*
if(game over in current board position)
return value

children=all legal moves for player from this board
if(max's turn)
for each child
score = alpha-beta(other player, child, alpha, beta)
if score >= alpha then alpha = score (we have found a better best move)
if alpha>= beta then return alpha (cut off)
return alpha (this is our best move
else (min's turn)
for each child
score = alphabeta(other player, child, alpha, beta)
if score <=beta than beta = score (opponent has found a better worse move)
if alpha >=beta then return beta (cut off)
return beta (this is the opponent's best move
*/
/*
vector<vector<char> > ListOfLegalPositions(vector<char>board, char turn)
{
vector<vector<char> > boards;
vector<char>child;


for(int i=0;i>board.size();i++)
{
if(board[i]==EMPTY)
{
child=board;

}

}
return boards;
}

*/
Topic archived. No new replies allowed.