| pics | first commit | |
| source | first commit | |
| .gitignore | first commit | |
| CMakeLists.txt | first commit | |
| LICENSE | first commit | |
| README.md | first commit | |
Introduction
This project presents the implementation of the Hot or Cold game as a case study application of the game loop game pattern or architecture.
The objective of this repo is to help the novice programmer to understand how to model a simple game or simulation using the game loop pattern.
Hot or Cold Gameplay
Your goal is the guess a secret integer between 1 and N (>1). You repeatedly guess integers between 1 and N. After each guess you learn if it equals the secret integer (and the game stops); otherwise (starting with the second guess), you learn if the guess is hotter (closer to) or colder (farther from) the secret number than your previous guess.
You may find a description of the problem here.
Modeling the Game
The first modeling step is to conceive the Finite-State Machine model for the game logic. After that, it becomes relatively easy to know what to include in each of the three methods present in the loop: process(), update(), and render().
The image below depicts the Finite-State Machine model for the Hot or Cold game.
The following image presents a list of all possible messages that may be send to the user based on the current game state.