Neural Expect Sarsa Reinforcement Learning Agent for Snake
This is the average performance of the agent after training for 1000 epochs
this gif is sped up to x2 speed
Before training, the program has to configure the OpenCV reading to read specific pixels to gather information for the training agent.
- The program first captures a screenshots of the selected monitor
- Using the precoded pixel color value, the program finds the dot in the top left corner
- Using the dot, the program reconfigures the OpenCV capture configuration to specifically focus on the grid
- The program then updates the other dot positions which convey additional information about the game state (more about the dots can be read in the game's repo readme)
- Finally, the program scans the grid and using the light levels of the 121 scanned pixels to determine the dimension of the grid. This is required as the game allows configurations of 11x11, 9x9, and also 7x7.
- After configuring, the agent can start training with the information read from the opencv thread