A Game of Thrones fan has built a neural network and trained it to write the next book in the A Song of Ice and Fire series. Fans have been waiting for a new novel from George R.R. Martin since A Dance with Dragons was released in 2011. At this point, the Game of Thrones TV show has far surpassed the source material novels, killing characters that haven’t died in the books yet, and revealing major details that Martin is yet to disclose in his writing.

Martin recently said to his fans, “I do think you will have a Westeros book from me in 2018”, but it’s not clear yet whether this will be The Winds of Winter or the first volume of Fire and Blood, the latter of which is a history of House Targaryen that Martin has been writing concurrently with the sixth novel in the main series. Martin did also tease the possibility that both of these books could come out next year.

While fans around the globe wait for the proper book, a full-stack software engineer named Zack Thoutt has trained a recurrent neural network to predict what will happen in The Winds of Winter. I’m a huge fan of Game of Thrones, the books and the show”, Thoutt told Vice. Having completed a course on artificial intelligence and deep learning, Thoutt decided “to give working with the books a shot”. This had some interesting results.

Author George RR Martin

Thoutt built his neural network and fed it the previous novels, coding in a “long short-term memory” that should – in theory – stop the network from repeating events that already happened and instead encourage it to produce true sequels to Martin’s existing works.

The network has been churning out chapters, and it has made some startling predictions about how Martin’s saga will play out. “Jaime killed Cersei and was full of cold and words”, the artificial intelligence wrote at one point, confirming, in its own way, without being prompted, the long-held fan theory that Jaime will go from Kingslayer to Queenslayer.

However, Thoutt’s network isn’t perfect. In some cases it does throw up interesting ideas – it says Sansa is a secret Baratheon at one point, for example. But it also writes about characters that have already died, makes up its own players, and struggles to make sense grammatically. “The model is striving to be a new book and to take everything into account,” Thoutt explained, “but it makes a lot of mistakes because the technology to train a perfect text generator that can remember complex plots over millions of words doesn't exist yet."

“If the model were that good authors might be in trouble”, Thoutt joked. Regardless of its faults, though, this is still a fascinating project, and it’s bound to get a lot of attention. If you’d like to check out this computer-generated version of The Winds of Winter, Thoutt has made the first five chapters available on GitHub.

MORE: 16 Game of Thrones Storylines They Want You To Forget

Game of Thrones season 8 and The Winds of Winter don’t have release dates yet. As more news unfolds, you’ll find it right here on Screen Rant.

Source: Vice