The Game Logic
Get an overview of our game's logic.
We'll cover the following...
The secret number
The game will generate a secret number that our player is supposed to guess. For that, we’ll use Java’s random number generator method, Math.random()
. More specifically, we’ll use Math.random() * (max - min + 1)
because this lets us specify a range for the random number. For example, if we want to generate a number between 40 and 70, we’ll use Math.random() * (70 - 40 + 1)
.
Note: The method
Math.random() * (max - min + 1)
returns a floating number (a number ...