Sub topic 11
Boundaries: where the game begins and ends
This chapter assumes you know the other formal elements: players, objectives, rules, and resources. It also assumes you can read short Python programs. Here you will learn what a boundary is, which kinds exist, how rules set them, and how to check in code that a game really ends.
What a boundary is
A boundary is a limit that separates what is part of the game from what is not. Boundaries answer four questions:
- Which actions count as moves?
- Who counts as a player?
- When does play start and stop?
- Where does play happen?
Boundaries are not a separate ingredient like resources. They come from rules. A rule such as "take 1 to 3 stones" puts a boundary around the legal actions, and a rule such as "the game ends when the pile is empty" puts one around time. Boundaries still deserve their own treatment, because a game with fuzzy boundaries is hard to teach, hard to test, and easy to argue about.
Theme and presentation have no effect on boundaries. A chess board can be marble or a phone screen, and the edge of the 8x8 grid is the same either way.
The main kinds of boundary
The kinds below overlap, but separating them makes a game easier to inspect.
| Kind | Question it answers | Example |
|---|---|---|
| Spatial | Where can pieces or avatars be? | The edge of a chessboard, the walls of a level |
| Temporal | When does play begin and end? | A match clock, a fixed number of rounds, a final whistle |
| Action | Which moves are allowed? | A pawn cannot move backward |
| Social | Who is in the game? | Two seated players, a team roster, spectators who may not act |
| Game versus non-game | What behavior is outside the game? | Table talk, real-world bribes, rewriting the rules mid-game |
A single rule can set several boundaries at once. "The match lasts 90 minutes on a pitch of fixed size" is temporal and spatial.
The game-versus-non-game boundary
Players agree to treat some things as inside the game and others as outside. A card player who bluffs is inside the game. A card player who marks the deck is outside it, because they broke an agreement the other players relied on. Some writers call this shared space the "magic circle". You do not need the metaphor. You only need to see that the boundary is an agreement among players, and it is only as sharp as that agreement.
This boundary is the one most often left implicit. Examples include whether you may discuss strategy with your teammate, whether you may look up a rule mid-turn, and whether a player may leave and come back. The earlier chapter on rules named implicit rules as a category, and many of them live here.
Start boundaries: setup
A game begins when the setup is finished and the first legal move becomes available. Setup defines:
- the starting amount of each resource
- the starting positions
- who moves first
- the allowed player counts
Two common errors occur at this boundary:
- Underspecified setup. If the rules never say who goes first, the first move becomes an argument. Games fix this with a roll, a convention such as "youngest player first", or a fixed seat order.
- Invalid starting states. Nim with zero stones has no first move. Nim with one stone is decided before it starts. A good setup rule excludes states that are broken or trivial.
End boundaries: termination
A game ends when an end condition is met. It helps to separate three ideas that people often blur:
- The objective is what players are trying to achieve ("take the last stone").
- The end condition is the state that stops play ("no stones remain").
- The outcome is the result that follows (who won, lost, or drew).
They often coincide, but they do not have to. In many games players can reach the end condition without achieving the objective. Chess ends in a draw on stalemate even though neither player has won. The next chapter covers outcomes in detail. Here we focus on whether and when play stops.
Ways a game can end
- Goal reached. A player achieves the objective, as when a Nim player takes the last stone.
- Resource exhaustion. A shared resource runs out, as when a draw pile empties.
- Fixed length. A number of rounds or a clock expires.
- No legal moves. The player to move cannot act, as in stalemate or a blocked position.
- Agreement or concession. A player resigns or both agree to a draw.
- Repetition or stagnation rules. The rules declare a draw after repeated positions or a long run without progress.
Termination is a design property
A game that always ends is guaranteed to terminate. You can often prove this by finding a quantity that strictly shrinks every turn. In Nim, every move removes at least one stone, so the game lasts at most stones turns. It also lasts at least ceil(stones / 3) turns, since no move removes more than three.
Games that let resources flow back, or let players pass, lose that guarantee. Players can then repeat positions forever. Designers add a boundary to repair this: a turn limit, a repetition rule, or a rule that forbids undoing the opponent's last move.
Boundaries in code
The Nim model from earlier chapters already contained boundaries without naming them. This version makes them explicit. The code adds a setup check, an is_over test, and a rule that no moves exist after the game ends.
from dataclasses import dataclass
PLAYERS = 2
MAX_TAKE = 3
@dataclass(frozen=True)
class State:
stones: int
current: int
def start(stones):
# start boundary: reject setups with no game in them
if stones < 1:
raise ValueError("a game needs at least one stone")
return State(stones, 0)
def is_over(state):
# end boundary: the end condition, separate from who won
return state.stones == 0
def legal_moves(state):
# action boundary, closed in time: no moves after the end
if is_over(state):
return []
return list(range(1, min(MAX_TAKE, state.stones) + 1))
def apply_move(state, take):
if take not in legal_moves(state):
raise ValueError("illegal move")
return State(state.stones - take, (state.current + 1) % PLAYERS)
s = start(5)
print(legal_moves(s)) # [1, 2, 3]
s = apply_move(apply_move(s, 3), 2)
print(is_over(s), legal_moves(s)) # True []Separating is_over from winner matches the distinction above between end condition and outcome. A different game could end on the same condition and score it differently.
Checking the termination guarantee
A boundary you can state is a boundary you can test. This script plays many random games and checks that each one ends within the bounds we derived. It reuses the definitions above.
import random
def random_game_length(stones):
state = start(stones)
turns = 0
while not is_over(state):
state = apply_move(state, random.choice(legal_moves(state)))
turns += 1
return turns
for stones in range(1, 30):
for _ in range(200):
turns = random_game_length(stones)
shortest = -(-stones // MAX_TAKE) # ceiling division
assert shortest <= turns <= stones
print("all games ended within bounds")When the guarantee fails
Now change one rule so a player may put a stone back. The shrinking quantity is gone, and a game of random moves may wander for a long time. A turn limit restores a boundary.
import random
def run_with_limit(stones, max_turns):
pile, turns = stones, 0
while pile > 0:
if turns >= max_turns:
return "draw", turns # time boundary closes the game
move = random.choice([-1, 1, 2, 3]) # -1 puts a stone back
if move <= pile:
pile -= move
turns += 1
return "ended", turns
random.seed(7)
for _ in range(5):
print(run_with_limit(10, 50))Each call returns either ("ended", n) or ("draw", 50). The new outcome, a draw by time, exists only because we added a boundary.
Boundaries and the other elements
Boundaries touch every other element.
- Players. The player-count rule is a social boundary. A game balanced for two may break with three, because the end condition or the turn order no longer fits.
- Objectives. The objective must be reachable inside the boundaries. If no legal sequence of moves can achieve it, the objective is empty.
- Rules. Rules are how boundaries get written down. An unclear boundary usually points to a missing rule.
- Resources. Limits on resources often are the temporal boundary. Resource exhaustion ends the game, so the starting stock sets its length.
Open-ended and persistent games
Not every game ends. Sandbox and live-service games may have no end condition at all, and a play session ends only because the player stops. These games still have boundaries:
- Action boundaries define what the avatar can do.
- Spatial boundaries define the map.
- Session boundaries, such as a save point or a daily reset, replace a single end of game.
The useful question is where the real stopping unit lies. Players in such games often set their own goals inside it. The designer controls the boundaries and leaves the objectives partly to the player.
Common errors
- Treating the end condition as the objective. The objective may be "have the most points" while the end condition is "the deck is empty".
- Leaving non-game behavior unspecified. Disputes about table talk, takebacks, and pausing come from an undefined game-versus-non-game boundary.
- Assuming termination. Any rule that returns resources, allows passing, or lets positions repeat needs a check that the game still ends.
- Ignoring dead positions. Some states leave one player with no possible way to win, yet the game goes on. Players call this a "dead game", and a concession or draw rule can handle it.
- Boundaries that depend on a referee. If a boundary needs human judgment, such as "a reasonable amount of time", it is a social agreement, not a rule you can test.
Summary of the procedure
To audit a game's boundaries:
- List the spatial, temporal, action, social, and game-versus-non-game boundaries.
- State the setup, including who moves first and which starting states are valid.
- State every way the game can end, and what outcome each way produces.
- For each end condition, find the quantity that makes it reachable. If you cannot find one, check whether a turn limit or repetition rule is needed.
- Mark boundaries that rest on player agreement, and decide whether any should become explicit rules.
Exercise
In the Nim model, a designer adds a rule that a player may pass once per game. Does the guarantee that the game lasts at most stones turns still hold? Give the new upper bound.
Show answer
The old bound no longer holds exactly, because a pass removes no stones. Each player can pass once, and a pass is a turn that does not shrink the pile. Every non-pass turn still removes at least one stone, so there are at most stones non-pass turns, plus at most 2 passes in total. The new upper bound is stones + 2 turns. The game still terminates, because passes are limited and the pile still shrinks on every other turn.
Exercise
Chess declares a draw when the same position occurs three times. Which kind of boundary is this, and which problem does it solve?
Show answer
It is a temporal boundary created by a rule that closes the game. Without it, players could repeat moves forever, because chess pieces can return to earlier squares and no quantity strictly shrinks each turn. The repetition rule restores a guarantee that the game ends, and it produces a draw outcome.
Exercise
A board game ends "when the draw pile is empty" and the winner is "the player with the most points". Name the objective, the end condition, and one way a player could use the end condition to their advantage.
Show answer
The objective is having the most points. The end condition is an empty draw pile. A player who is ahead can draw cards faster than needed to empty the pile and end the game early, before opponents can catch up.