If we're talking anecdotes, I've always been most creative when I have tight constraints to work within (technical, time, aesthetic etc). For example, some of my most imaginative code was when trying to fit some code into a teeny tiny microcontroller. Some of the most fun too (provided that time wasn't also a constraint, I find that mixing a time constraint with other constraints often turns it from a fun puzzle to a stressful task).