TMC - 8 Digital Tech
Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto mode

What is state?

What is state?

Imagine you are enjoying a particularly engaging session of Uno with some friends, and by a peculiar set of circumstances you are required to pack up the game back into its pack, but you and your friends want to be able to resume exactly where you are when you next meet. What would you have to record so that you can restore the game exactly as it is right now?

You would need to note who is playing and which order they are sitting in, and also which cards they are holding. You’d also need to know whose turn it is and, because of the reverse cards, which direction you’re currently playing in.

Would you need to jot down which cards are in the deck or the discard pile, and which order they are in? Why, or why not? What differece will it make?

This whole question of what is required to keep track of the game is called the game’s state. For some games, it is very little. Consider what you would have to record to pause, and later resume, a game of Noughts and Crosses. How about draughts, or chess? Could you pause a live-action game of soccer in mid play, and resume it later?