Changed the code quite a lot. It now learns based on previous moves based on what moves worked in the past.