GameRules

interface GameRules<State, Move, Actor, View>

The generic rules contract a game engine exposes so a domain-agnostic search (see Ismcts) can drive self-play without knowing the concrete rules. View is the redacted/secrecy-safe projection of State a Policy is allowed to see (produced by redact) — kept as its own type parameter (rather than derived from State) because the secrecy boundary is a distinct type in every engine that adopts this contract.

Functions

Link copied to clipboard
abstract fun apply(state: State, move: Move): Outcome<State>

Validate move against state and produce the next state, or reject it.

Link copied to clipboard
abstract fun isTerminal(state: State): Boolean

True once state is decided — no further moves are legal.

Link copied to clipboard
abstract fun legalMoves(state: State, actor: Actor): List<Move>

Concrete legal moves for actor given state (only non-empty when it is actor's turn to act).

Link copied to clipboard
abstract fun redact(state: State, viewer: Actor): View

Project state to what viewer is allowed to see — the strict-subset secrecy boundary.

Link copied to clipboard
abstract fun whoActsNext(state: State): Actor?

The single actor whose input is needed next, or null when state is terminal.

Link copied to clipboard
abstract fun winner(state: State): Actor?

The winning Actor, or null if state is not yet terminal.