The writer behind the Games of Thrones phenomenon, the success of the books and TV series inspired by his book saga A Song of Fire and Ice, has admitted that sometimes obsessed fans guess correctly where his famously bloody plotlines may go next.

At a packed appearance at the Edinburgh International Book Festival, the American author George RR Martin - who is working on two more novels in the series, as well as publishing a guide to his world of Westeros - said that sometimes fevered fan speculation online has read his mind.

Martin, 65, who has been called the "American Tolkien" and whose work has inspired the successful Game of Thrones TV series, said he does not change plots if fans guess correctly, just to confound them.

He also outlined how much Scotland and Scottish history has inspired his books.

Martin began the session by explaining how a visit to Hadrian's Wall had inspired him to create the epic ice wall in his books, and that jokingly said, referring to the looming Independence Referendum: "If Scotland does secede it should built a gigantic wall of ice, it would be a great tourist attraction, as well as keep the English out."

Of the many fan theories on the internet and elsewhere, he told the audience: "I have wrestled with this issue, as I want to surprise my readers.

"I hate predictable fiction, I want to surprise and delight my readers and take the story in directions they didn't see coming.

"But, I can't change the plans and that is one of the reasons why I used to read these fan [internet] boards back in the 1990s, the early ones, and then I stopped.

"There was this issue that so many readers were reading the books with so much attention and throwing up so many theories - and some of the theories were amusing bullsh*t but very creative - but some of them were right.

"The readers, at least one or two, had correctly put together the clues that I what do I do then? Do I change it?

"I wrestled with it, but I think changing it would have been a disaster. The clues were there."

He said that he doesn't now follow the many fan websites that are online discussing his novels and characters too closely.

"But it pleases me no end that people are discussing the characters as if they were real," he said.

"Its a sign that I have create real characters and not just blank pieces of cardboard."

Martin said several female characters from Scottish history had inspired characters in the saga.

"I enjoyed Xena the Warrior Princess a lot but I did not think it was an accurate portrayal of what a women warrior was or would be like, and I sort of created Brienne of Tarth as an answer to that.

"I was inspired by people like Eleanor of Aquitaine and not so much Joan of Arc, but the Queens of Scottish history, from Lady Macbeth on down, were strong women who didn't put on chain mail bikinis to go forth into battle, but exercised immense powers by other ways.

"Mary Queen of Scots, was an idiot but was certainly a strong woman and she ran against a stronger and rather smarter woman [Elizabeth I] and came out on the losing end, but still a fascinating character in her own way."

He added: "I don't really have a relationship with Scotland, I have visited perhaps a half a dozen times over the years," he said.

"I visited in 1981...we hit Hadrians Wall, which was 10 years even before I started writing it. I remmeber standing there, it was October, a cold day and grey and I stood on that wall and stared off into Scotland and tried to think of what it might like to be a Roman legionary who was posted there at the end of the world, and I thought I had to capture this.

"But fantasy is always bigger, so I made the wall 100 times as high, much longer and made it of ice - which would be much cooler, I personally think if Scotland does secede, the first thing it should do is build a gigantic wall of ice between Scotland and England, it would be a great tourist attraction and then you could keep the English out too."