I'm making a noughts and crosses AI using negamax and to do this I must run through all the possible moves you could make from any board state. I'm attempting to do this by appending each possible version of the board to a list however it will only append the final state to the list.
Here is my code:
def allPossibleMoves(board, turn):
l = []
for i in range(0,3):
for x in range(0,3):
if board[i][x] == ' ':
board[i][x] = turn
print(board)
l.append(board)
board[i][x] = ' '
return l