I am trying to create a q-table in a dictionary for an AI I am trying to make but when trying to make the dictionary after about 40,000,000 possible positions are inputted into the q-table (dicitonary) the process starts to really slow down and at about 80,000,000 and is going as slow as a snail (about 18 hours to get to 80,000,000) and seems to keep slowing down. I would like to know if there would be a way to optimize my dictionary or my code in some way to speed this process up because as this rate it is going to take a year to finish the creation of the q-table (about 160,000,000 positions on the q-table).
Here is my code if it helps:
start_q_table = None
if start_q_table is None:
q_table = {}
# All possible height differences between the bird and the bottom pipe
for i in range(-display_height, display_height):
# ^^^ = -800 ^^^ = 800
# All possible distances between the bird and the end of the nearest pipe
for ii in range(-bird_size, display_height + pipe_distance):
# ^^^ = 15 ^^^ = ~ 1000 total
# Bird speed
for iii in speed_range:
# ^^^ = range(1000)
q_table[(i, ii, iii)] = [np.random.uniform(-1, 0) for i in range(3)]