So apparently he wrote the program billions of years ago and knew each and every event that would transpire including the yet to be realized historical fact that you will fall on your knees on the third Tuesday next month and ask him to get you out of (yet another) rut. Of course he knew that. He wouldn't be all knowing if there were something he didn't already know. And he also knew even before he sat down to write down the code (which he didn't have to really being all-knowing and all-powerful) that he, the Supreme Genie, would grant or not grant you your wish. Well, of course he knew. And he knew since even before the beginning of time (if it even makes sense to talk about something before time) that he would create this particular universe with the particular events that have and will transpire. And needless to say he knew even before time who would end up singing and playing the harps for him for eternity up there and who would oh so unfortunately be wallowing with the greatest scientists and philosophers down there forever and ever, listening to lectures and engaging in fiery debates.
So the guy who knows everything and can do anything chose to snap into being a world that causes so much grief and suffering and yet made some far more gifted between the ears than others, a feature which makes them realize the illogic and silliness of all this god crap.
Oh dear. Now this is all so confusing. Lord, help me understand. I beseech you, in the bowels of Christ, enlighten this humble toady of yours. But of course you knew I'd say that today even way back bazillions of gazillions of centuries ago, right?