A room behaves differently when its light switch is on or off. A game behaves differently when it is playing, paused, won, or lost. That remembered situation is called state. State is just data that answers: what mode are we in right now?
Tap the scene. One variable changes, but that one change controls the sky, stars, ground, and label.
A boolean is perfect for one yes/no fact: let paused = false. But a game with playing, won, and lost should use one string such as gameState = 'playing'. If you used three booleans, your program could accidentally be winning and losing at the same time.
Question: If mode is currently 'night', what is it after one tap? What about two taps?
Answer: After one tap it is 'day'. After two taps it is back to 'night'. Each event follows one arrow in the diagram.
'night'. Put their drawing code inside the night branch.'sunset'. Draw its box and arrows on paper before editing the code.D sets day and pressing N sets night. Use keyPressed().let paused = false. Press the space bar to toggle it, and only move a cloud when paused == false.== to =. Observe the strange behaviour, then explain why c11 warned about this exact typo.