Sub topic 12
Outcome: How a Game Resolves
This chapter assumes you understand the basic formal elements of a game: players, objectives, rules, procedures, and resources. You will use those elements to describe how a game ends and how it determines the result.
What an outcome is
An outcome is the state that a game reaches when its resolution condition has been met. Resolution is the process of checking that condition and deciding what the result means for each player.
The outcome is related to the objective, but they are not the same:
- An objective describes what a player is trying to achieve.
- An outcome describes what happens when the game determines whether that objective was achieved.
- A rule defines the conditions and actions that lead to the outcome.
For example, in chess, a player’s objective is to checkmate the opposing king. The outcome is a win for one player when checkmate occurs. A stalemate produces a draw because the rules define a different terminal condition.
A terminal state is a game state in which no further normal play should occur. A terminal state can produce a win, a loss, a draw, a score, or another result.
Types of outcomes
Games commonly use one or more of these outcome structures:
| Outcome structure | How it resolves | Example |
|---|---|---|
| Win or loss | One player satisfies the winning condition | Checkmate in chess |
| Draw | No player wins, or the rules force a tie | A tied score after a sports match |
| Ranked score | Players receive values that determine order | Victory points in a board game |
| Shared success | Several players meet a common condition | A cooperative team defeats a boss |
| Partial success | Players meet some goals but not all | A mission game with optional objectives |
A game can combine structures. A competitive game might award first, second, and third place. A cooperative game might give the whole group a win or loss while also recording each player’s individual score.
Defining resolution precisely
A useful outcome specification answers three questions:
- What event ends the game?
- What condition determines each player’s result?
- What happens if several conditions become true at once?
Consider a stone-taking game:
- The game ends when the pile contains zero stones.
- The player who takes the last stone wins.
- Each turn must remove one to three stones.
The first statement is the end condition. The second is the result condition. The third is a rule that controls how players reach the end.
The order of checks matters. If a move removes the last stone, the game should check for the terminal state before starting the next player’s turn. Otherwise, the game may incorrectly award the result to the wrong player.
from dataclasses import dataclass
@dataclass(frozen=True)
class State:
stones: int
current_player: int
def apply_move(state: State, take: int) -> State:
if not 1 <= take <= 3 or take > state.stones:
raise ValueError("illegal move")
next_player = 1 - state.current_player
return State(state.stones - take, next_player)
def outcome(state: State):
if state.stones != 0:
return None
winner = 1 - state.current_player
return {"status": "finished", "winner": winner}
state = State(stones=4, current_player=0)
state = apply_move(state, 3)
print(outcome(state)) # None: one stone remains
state = apply_move(state, 1)
print(outcome(state)) # Player 0 winsThe current_player field always identifies the player whose turn would be next. After the last stone is removed, the previous player is therefore the winner.
Changing the resolution rule
Small changes to the outcome rule can create a different game. In normal Nim, taking the last stone wins. In misère Nim, taking the last stone loses. The players, resource, and move limit can remain unchanged while the best strategy changes.
This is why outcome rules must be written separately from objectives and procedures. A player may have the same apparent goal, such as removing stones, but a different resolution rule changes which actions are valuable.
Testing outcomes
When analyzing or implementing a game, test at least these cases:
- A normal move that does not end the game.
- The move that reaches the winning condition.
- A draw or tie condition, if one exists.
- Two conditions becoming true at the same time.
- An invalid action attempted after the game has ended.
These cases expose unclear boundaries. For example, if a game can end because a player reaches a target score or because the resource pile is empty, specify which condition takes priority when both happen after one action.
Exercise
In a game where the first player to reach 10 points wins, what must the rules specify if both players reach 10 points during the same round?
Show answer
The rules must define a tie-break procedure, such as comparing total points, playing an extra round, or declaring a draw.