You weren't meant to copy that. It was just a representation of your main game loop, if you had it. You need to develop this logic on your own. You won't always get to copy. If you don't understand this kind of logic yet, I'd suggest looking for a programming course online. Even if they use other programming languages, the main logic still applies. I'd suggest the course provided by Khan Academy.