I think the main() function controls the flow of the game at the highest level, right from the moment you start till the moment you either die or finish the game successfully.
For example, it makes sure that after you finish one difficulty level, it takes you to the next one.