If I execute these lines of code in python:
states = itertools.product("012",repeat = 16)
states = list(states)
Then I use up more memory than I have on my laptop. Is there a way around this? I need this list of states so that when I generate a new state, I can update its value in the list.
Edit: I'm storing these states for a 4x4 grid,where 0, 1, and 2 are the possible states of each square on the grid. The value being stored is actually a 16 length list that says what the reward is for making a move to any of the squares on the grid from the current state. With impossible moves being marked with -np.inf. As the game is played the reward for moves that lead to winning from certain states increases, so that the bot is more likely to make that move in the future.
Ex: A simplified example for tic-tac-toe.
x| |o
| |
o| |
This state would be translated to a 9 length list, '102000200', and when it'd be looked up in the list of all possible states to see what the next best move is. Which in this case would be the middle spot for x.