Sub topic 4
Rules: Defining What Is and Is Not Allowed
Assume you have played several board, card, or video games and can read simple Python. This chapter focuses on rules as formal parts of a game. A rule is a constraint that defines what can happen, what players may do, and how the game responds.
Rules are different from theme and objectives. “The wizard protects the kingdom” is theme. “The player wins by collecting 10 gems” is an objective. “A player may move one space per turn” is a rule. The objective describes the desired result. The rule defines the permitted path toward it.
Three kinds of rules
Game designers often classify rules by the job they perform.
| Rule type | Purpose | Example |
|---|---|---|
| Operational | Tells players what to do during play | Draw one card at the start of your turn |
| Constitutive | Defines the underlying system | A set contains three cards of the same rank |
| Implicit | Relies on shared expectations | Players do not deliberately hide a required game state |
Operational rules are instructions players follow directly. Constitutive rules define what game objects and actions mean. For example, a chess rule says that a bishop moves diagonally. Without that rule, the piece is only a token with a visual theme.
Implicit rules are social expectations rather than fully written procedures. Players usually expect others to play in good faith, take turns, and avoid tampering with the game. Digital games can enforce many rules automatically, while physical games often depend on player agreement.
A strong ruleset makes important rules explicit. If players must guess how a tie works, the game may produce arguments instead of meaningful decisions.
Describe rules as testable constraints
An unambiguous rule identifies:
- The actor: who may perform the action.
- The timing: when the action is available.
- The condition: what must be true first.
- The action: what changes.
- The result: what happens afterward.
- Any limits: what the actor cannot do.
For example:
> On your turn, if at least one stone remains, take one, two, or three stones. The next player then takes a turn.
This rule states the actor, timing, condition, available action, and turn transition. It also gives a tester enough information to check whether a move is legal.
A useful distinction is between a legal move and a possible move. A player might be physically able to move a piece, but the rules determine whether that move is legal. In a digital game, the program should reject illegal input. In a tabletop game, the players or a referee enforce the same boundary.
from dataclasses import dataclass
MAX_TAKE = 3
PLAYER_COUNT = 2
@dataclass(frozen=True)
class State:
stones: int
current_player: int
def legal_moves(state: State) -> list[int]:
return list(range(1, min(MAX_TAKE, state.stones) + 1))
def apply_move(state: State, take: int) -> State:
if take not in legal_moves(state):
raise ValueError("That move is not legal.")
return State(
stones=state.stones - take,
current_player=(state.current_player + 1) % PLAYER_COUNT,
)
state = State(stones=5, current_player=0)
print(legal_moves(state))
print(apply_move(state, 2))Here, legal_moves expresses the move boundary. apply_move enforces it. The code does not decide whether taking the last stone wins. That is a separate objective or outcome rule.
Rules create boundaries
Rules define the game’s state space: the set of situations that can legally occur. They also create meaningful choices by removing some actions and allowing others. If every action is allowed, players have freedom but little structure. If almost no action is allowed, the game becomes predictable or frustrating.
Changing one rule can change the entire decision system. Raising the maximum number of stones in Nim creates more possible moves. Allowing players to pass adds a new procedure. Making the last stone harmful changes the value of every earlier move, even though the resource and turn order stay the same.
Exercise
Exercise
Rewrite this vague rule as a testable rule: “Players can trade when they want.”
Show answer
During the trading phase of a player’s turn, that player may offer one resource to one other player. The other player may accept or reject the offer. A trade occurs only if both players agree.