From the time you begin prototyping, to your finished product, most of us will have to rewrite either the entire game or significant parts of it. Especially if you're diving into some new technology, the techniques you learn along the way can make your early work pretty miserable, and, worst case scenario, cause some problems with the game itself.
This is a companion discussion topic for the original entry at https://blog.pbbg.com/when-to-re-write/