The game cycle
As we said in the Foreword, Elemental Java uses games as a motivating application to learn computer programming. What we consider a game ranges from board games and card games to first-person shooters. We also include puzzles in what we consider a game. Almost all games can be abstractly represented in the simple model below.

The first step is to initialize the game state. Game state is a particularly important concept at this stage of our work, so we're going to focus on that and leave the rest of the cycle to be discussed later.
Game State
Game state is what you have to save in case you need to stop playing and resume your game later. If your game is Tic-Tac-Toe, the game state is the state of the board—all the X's and O's— plus whose turn it is. If your game is Chess, the game state is what pieces are on which squares, and whose turn it is. If your game is Poker, the game state is the contents of each player’s hand, what cards have been played, the cards that remain in the deck, where the game is in the bid/play cycle, and whose turn it is to bid or play. If your game is Rush Hour (Figure Rush Hour), the game state is which pieces, in which orientations, are in which squares.

If your game is Pong (Figure Pong), the game state is the position, speed, and direction of the ball, the position of each player's paddle, and the score.

If your game is Breakout (Figure Breakout), the game state is the position, speed, and direction of the ball, the position of the player's paddle, and the state of the array of blocks (which blocks have been knocked out).

Game State Modeling
If we're going to represent a game as a computer program, the first step is to model, or represent, the game state using the data modeling mechanisms the programming language we are using provides. Data modeling is a concern of not just game programming; it's a core concern of nearly every computer program, whether it's a game, tax-filing software, engine control modules, or a supply chain modeling program.