In general, a computer game has five elements:
A game is a perfect combination of actions-reactions or event-responses where every response is based on the most-recently occurred event.
A game is a closed, i.e., complete and self sufficient formal system that represents a subset of reality. Game programming is one common example of event driven programming. Event driven programming refers to that style of programming wherein the user of the application is free to choose from several options rather than be confined to a predetermined sequence of interactions with the program. Before we actually jump into game programming, we need to know something called event driven programming.