Douglas Adams, author of The Hitchhiker’s Guide to the Galaxy, was once locked in a room for three weeks until he completed one of his books.
Victor Hugo, when faced with a deadline for his book The Hunchback of Notre Dame, locked all his clothes away except for a large shawl. “Lacking any suitable clothing to go outdoors, [he] was no longer tempted to leave the house and get distracted. Staying inside and writing was his only option.” Six months later, the book was published.
Dozens of famous authors have done the same. Virginia Woolf, Henry David Thoreau, Mark Twain—all of them constructed small writing sheds from which to work. Ian Fleming, Maya Angelou, and George Orwell—the first two penned their novels while locked in hotel rooms, while Orwell isolated himself on a remote Scottish island to write.
One explanation for this reclusive behavior comes from author Neil Gaiman in an interview he did with Tim Ferriss a few years ago. Ferriss mentioned Gaiman’s most important rule for writing:
You can sit here and write, or you can sit here and do nothing. But you can’t sit here and do anything else.
Gaiman, after a moment of reflection, responded by saying:
I would go down to my lovely little gazebo [at the] bottom of the garden [and] sit down. I’m absolutely allowed not to do anything. I’m allowed to sit at my desk. I’m allowed to stare out at the world. I’m allowed to do anything I like, as long as it isn’t anything. Not allowed to do a crossword; not allowed to read a book; not allowed to phone a friend. All I’m allowed to do is absolutely nothing or write.
What I love about that is I’m giving myself permission to write or not write. But writing is actually more interesting than doing nothing after a while. You sit there and you’ve been staring out the window now for five minutes, and it kind of loses its charm. You [eventually think], “well actually…[I] might as well write something.”
Between writing or doing anything else, most writers—even some of the most accomplished ones—acquiesce to distraction. That’s why so many of them work in environments devoid of external stimuli—the better to circumvent akrasia.
I do all my writing in coffee shops. Similar to Gaiman, I allow myself to do one of two things: write, or people-watch. I don’t bring anything with me except for a pencil, paper, and my research material housed in my journals. That means no phone, no laptop, and no watch (even knowing the time is a kind of distraction and pressure to perform).
Within this environment, I end up writing because I’ve made it the path of least resistance.
There seems to be some variance in how deprivation affects creativity. I have a friend who will start hallucinating if she stares long enough at a white wall alone. Most people probably won't though, and would just experience some dull mind-wandering.
There's something going on with social deprivation and creativity. Monastic orders like Benedictine Christians and Zen Buddhists encourage long periods of silence, along with sensory deprivation like fasting, and it seems to work for them. If you have some kind of psychological discipline (innate or trained) to maintain your focus, you may enter a deep, undistracted flow state. But if you don't have that discipline, it's probably better to have some social stimulation so that you don't feel strained and uninspired from the lack of new social input.