Revamping the Algorithm
Now that we have our new complexity, we can start to work on our new QLearning version of the snake.
All that has to be done is take the original Q-Learning snake and change the verison of snake it is using to the new snake that was just creatd. As time has run out on the semeseter, I will leave this as a challenge to the viewer.
The basic idea would be something like this.
import qsnake.py
import complex_snake.py
#Create new game
def class QGame(qsnake.QGame):
def __init__(self):
super().__init__()
#Overwrite old snake
self.snake = complex_snake.Snake()
def class QTable(qsnake.QTable):
def encodeState(self, snake_obj, food):
#Change the encoding to include the blocks from complex_snake
Once those changes have been made, the Q-Leanring algorihtm will be applied to the new complexity. We will examine the results in the final post.