Use classes and functions.
When you want to start over, use functions to reset the state of your objects and call the function where your code beings.
Alternatively, you can put your whole code in a loop with some exit condition, which can control whether "restart" is required or not.