The Ludii Game Description Language is Universal

Dennis J.N.J. Soemers,1 Éric Piette,2 Matthew Stephenson,3 and Cameron Browne4 1Department of Advanced Computing Sciences, Maastricht University
Email: [email protected]
2ICTEAM, Université catholique de Louvain
Email: [email protected]
3College of Science and Engineering, Flinders University
Email: [email protected]
4Email: [email protected]
Abstract

There are several different game description languages (GDLs), each intended to allow wide ranges of arbitrary games (i.e., general games) to be described in a single higher-level language than general-purpose programming languages. Games described in such formats can subsequently be presented as challenges for automated general game playing agents, which are expected to be capable of playing any arbitrary game described in such a language without prior knowledge about the games to be played. The language used by the Ludii general game system was previously shown to be capable of representing equivalent games for any arbitrary, finite, deterministic, fully observable extensive-form game. In this paper, we prove its universality by extending this to include finite non-deterministic and imperfect-information games.

Index Terms:
Ludii, game description language, general game playing

I Introduction

General Game Playing (GGP) is a subfield of Artificial Intelligence (AI) research, in which the challenge is to develop agents that can successfully play arbitrary games without human intervention or prior knowledge of exactly which games are to be played [1]. Implementing such an agent in practice typically requires the use of a Game Description Language (GDL); a standardised format such that the rules of any game can be provided to an agent without having to implement it directly in a general-purpose programming language.

The GDL that popularised GGP research [2, 3] originated primarily from Stanford; we refer to it as S-GDL in this paper. Other systems with GDLs include Regular Boardgames (RBG) [4] and Ludii [5, 6] for general games, as well as GVGAI [7, 8] for video games. Aside from facilitating GGP research, the use of domain-specific languages has also been proposed for the ease with which they enable the implementation of custom, targeted testbeds [9].

S-GDL is a relatively low-level logic-based GDL. After the introduction of an extension to support randomness and imperfect information [10], it was proven that S-GDL is universal [11]; any arbitrary finite extensive-form [12] game can be faithfully represented in a legal S-GDL description. For the GDL of RBG, this was only proven for the subset of fully-observable, deterministic games [4]. Similarly, Ludii’s GDL (L-GDL) was previously only proven to be capable of representing any finite, deterministic, perfect-information, alternating-move game, although it did already include basic support for stochasticity and hidden information (without a proof of universality) [6].

For S-GDL, the proof of its universality [11] essentially consists of encoding the entire game tree of any arbitrary finite extensive-form game in logic statements. L-GDL is a comparatively higher-level language that primarily consists of many keywords that game designers and players can readily understand as common game terms, such as board, piece, slide, hop, and so on. By design, it is intended to be easier to read, understand and use for game designers [13], with less of a focus on including the low-level language elements that would enable the exhaustive enumeration of all states of an extensive-form game tree. It has a relatively tightly-enforced structure, with many enforced restrictions due to strong ty**. In comparison to the lower-level S-GDL with a relatively flat structure that makes it straightforward to exhaustively enumerate a complete game tree, this makes it non-trivial to prove a similar level of generality for L-GDL. Nevertheless, in this paper we are able to prove the universality of L-GDL by demonstrating that it can represent the same class of games as proven by Thielscher [11] for S-GDL, including games with randomness and hidden information. This provides a theoretical argument that L-GDL is a suitable, sufficiently general and powerful description language for problems for AI research.

The remainder of this paper is structured as follows. Section II provides the necessary background information on extensive-form games and the L-GDL game description language. Next, Section III proposes a detailed procedure that, for any finite extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G, creates a matching L-GDL game description for a Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT. Section IV formally states a theorem of equivalence for 𝒢𝒢\mathcal{G}caligraphic_G and 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT, and proves the theorem. In Section V, we provide a brief discussion of two related topics that may be considered of interest around the main theorem. Finally, Section VI concludes the paper.

II Background

In this section, we provide background information on the standard, universal formalism of extensive-form games, as well as L-GDL.

II-A Extensive-Form Games

Extensive-form games [12] are a standard, general formalisation of games in the broad, mathematical sense of the word (i.e., including many decision-making problems that would not generally be viewed by most humans as “fun” games). The formal definition is as follows:

Definition 1.

An extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G is specified by a tuple 𝒢=𝒫,𝒯,𝒰,ι,𝒟,𝒢𝒫𝒯𝒰𝜄𝒟\mathcal{G}=\langle\mathcal{P},\mathcal{T},\mathcal{U},\iota,\mathcal{D},% \mathcal{I}\ranglecaligraphic_G = ⟨ caligraphic_P , caligraphic_T , caligraphic_U , italic_ι , caligraphic_D , caligraphic_I ⟩, where:

  • 𝒫={1,2,,k,η}𝒫12𝑘𝜂\mathcal{P}=\{1,2,\dots,k,\eta\}caligraphic_P = { 1 , 2 , … , italic_k , italic_η } is a finite set of k1𝑘1k\geq 1italic_k ≥ 1 players, and a “nature” player η𝜂\etaitalic_η to model stochastic events.

  • 𝒯𝒯\mathcal{T}caligraphic_T is a finite tree, where every node represents a single game state s𝒮𝑠𝒮s\in\mathcal{S}italic_s ∈ caligraphic_S. The full set of states 𝒮=𝒮inn𝒮ter𝒮subscript𝒮𝑖𝑛𝑛subscript𝒮𝑡𝑒𝑟\mathcal{S}=\mathcal{S}_{inn}\cup\mathcal{S}_{ter}caligraphic_S = caligraphic_S start_POSTSUBSCRIPT italic_i italic_n italic_n end_POSTSUBSCRIPT ∪ caligraphic_S start_POSTSUBSCRIPT italic_t italic_e italic_r end_POSTSUBSCRIPT may be partitioned into a subset of non-terminal states (inner nodes) 𝒮innsubscript𝒮𝑖𝑛𝑛\mathcal{S}_{inn}caligraphic_S start_POSTSUBSCRIPT italic_i italic_n italic_n end_POSTSUBSCRIPT and a subset of terminal states (leaf nodes) 𝒮tersubscript𝒮𝑡𝑒𝑟\mathcal{S}_{ter}caligraphic_S start_POSTSUBSCRIPT italic_t italic_e italic_r end_POSTSUBSCRIPT, such that 𝒮inn𝒮ter=subscript𝒮𝑖𝑛𝑛subscript𝒮𝑡𝑒𝑟\mathcal{S}_{inn}\cap\mathcal{S}_{ter}=\varnothingcaligraphic_S start_POSTSUBSCRIPT italic_i italic_n italic_n end_POSTSUBSCRIPT ∩ caligraphic_S start_POSTSUBSCRIPT italic_t italic_e italic_r end_POSTSUBSCRIPT = ∅. Every branch of the tree represents a possible transition between states.

  • 𝒰:𝒮terk:𝒰maps-tosubscript𝒮𝑡𝑒𝑟superscript𝑘\mathcal{U}:\mathcal{S}_{ter}\mapsto\mathbb{R}^{k}caligraphic_U : caligraphic_S start_POSTSUBSCRIPT italic_t italic_e italic_r end_POSTSUBSCRIPT ↦ blackboard_R start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT is a payoffs function, such that 𝒰(s)𝒰𝑠\mathcal{U}(s)caligraphic_U ( italic_s ) denotes a vector of k𝑘kitalic_k real-valued payoffs (for the k𝑘kitalic_k players) for any terminal game state s𝒮ter𝑠subscript𝒮𝑡𝑒𝑟s\in\mathcal{S}_{ter}italic_s ∈ caligraphic_S start_POSTSUBSCRIPT italic_t italic_e italic_r end_POSTSUBSCRIPT.

  • ι:𝒮inn𝒫:𝜄maps-tosubscript𝒮𝑖𝑛𝑛𝒫\iota:\mathcal{S}_{inn}\mapsto\mathcal{P}italic_ι : caligraphic_S start_POSTSUBSCRIPT italic_i italic_n italic_n end_POSTSUBSCRIPT ↦ caligraphic_P is a function such that, for any non-terminal game state sSinn𝑠subscript𝑆𝑖𝑛𝑛s\in S_{inn}italic_s ∈ italic_S start_POSTSUBSCRIPT italic_i italic_n italic_n end_POSTSUBSCRIPT, ι(s)𝜄𝑠\iota(s)italic_ι ( italic_s ) gives the player to play in that state. Whenever ι(s)η𝜄𝑠𝜂\iota(s)\neq\etaitalic_ι ( italic_s ) ≠ italic_η (i.e., whenever we are not in a chance node), the player gets to choose which branch to follow down the tree (it is not permitted to go back up to the parent node).

  • 𝒟:{(s,s)ι(s)=η,s𝒮inn,s𝒮}:𝒟maps-toconditional-set𝑠superscript𝑠formulae-sequence𝜄𝑠𝜂formulae-sequence𝑠subscript𝒮𝑖𝑛𝑛superscript𝑠𝒮\mathcal{D}:\{(s,s^{\prime})\mid\iota(s)=\eta,s\in\mathcal{S}_{inn},s^{\prime}% \in\mathcal{S}\}\mapsto\mathbb{R}caligraphic_D : { ( italic_s , italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) ∣ italic_ι ( italic_s ) = italic_η , italic_s ∈ caligraphic_S start_POSTSUBSCRIPT italic_i italic_n italic_n end_POSTSUBSCRIPT , italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∈ caligraphic_S } ↦ blackboard_R gives, for any non-terminal state s𝑠sitalic_s controlled by the nature player η𝜂\etaitalic_η, a probability 0𝒟(s,s)10𝒟𝑠superscript𝑠10\leq\mathcal{D}(s,s^{\prime})\leq 10 ≤ caligraphic_D ( italic_s , italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) ≤ 1 that the nature player “selects” ssuperscript𝑠s^{\prime}italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT as the successor. Note that this must yield proper probability distributions over successors, i.e. s{sι(s)=η,s𝒮inn}:s𝒮𝒟(s,s)=1:for-all𝑠conditional-set𝑠formulae-sequence𝜄𝑠𝜂𝑠subscript𝒮𝑖𝑛𝑛subscriptsuperscript𝑠𝒮𝒟𝑠superscript𝑠1\forall s\in\{s\mid\iota(s)=\eta,s\in\mathcal{S}_{inn}\}:\sum_{s^{\prime}\in% \mathcal{S}}\mathcal{D}(s,s^{\prime})=1∀ italic_s ∈ { italic_s ∣ italic_ι ( italic_s ) = italic_η , italic_s ∈ caligraphic_S start_POSTSUBSCRIPT italic_i italic_n italic_n end_POSTSUBSCRIPT } : ∑ start_POSTSUBSCRIPT italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∈ caligraphic_S end_POSTSUBSCRIPT caligraphic_D ( italic_s , italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) = 1.

  • :{(p,s)p𝒫{η},s𝒮}(𝒮):maps-toconditional-set𝑝𝑠formulae-sequence𝑝𝒫𝜂𝑠𝒮𝒮\mathcal{I}:\{(p,s)\mid p\in\mathcal{P}\setminus\{\eta\},s\in\mathcal{S}\}% \mapsto\mathbb{P}(\mathcal{S})caligraphic_I : { ( italic_p , italic_s ) ∣ italic_p ∈ caligraphic_P ∖ { italic_η } , italic_s ∈ caligraphic_S } ↦ blackboard_P ( caligraphic_S ), where (𝒮)𝒮\mathbb{P}(\mathcal{S})blackboard_P ( caligraphic_S ) denotes the powerset of 𝒮𝒮\mathcal{S}caligraphic_S, gives the information set (p,s)𝑝𝑠\mathcal{I}(p,s)caligraphic_I ( italic_p , italic_s ) of player p𝑝pitalic_p for state s𝑠sitalic_s (i.e., the set of states that are indistinguishable from each other from the perspective of player p𝑝pitalic_p when the true state is s𝑠sitalic_s).

In this paper, we focus on finite extensive-form games 𝒢𝒢\mathcal{G}caligraphic_G, where 𝒯𝒯\mathcal{T}caligraphic_T is of a finite size. Furthermore, we focus on sequential-move games, since the function ι𝜄\iotaitalic_ι gives only a single player to move per game state s𝑠sitalic_s. In theory, this is without loss of generality, since any simultaneous-move game can be equivalently modelled as an sequential-move game in which the effects of moves are delayed until every active player in a turn has selected their move, and moves within the same turn are hidden information for all other players [14]. In practice, Ludii does contain additional support for modelling simultaneous-move games, but for our theoretical analysis we do not need this.

II-B L-GDL

The basic structure of an L-GDL game description is depicted in Figure 1. It is defined by a grammar [15], automatically derived from Ludii’s source code [13], which specifies which keywords (also referred to as ludemes) and types of data (strings, integers, real numbers, and so on) can or cannot be used depending on the context. As shown by Figure 1, a game description file is expected to describe exactly one game, which has three top-level entries:

  1. 1.

    players: describes basic data about the players (e.g., how many players the game is played by).

  2. 2.

    equipment: describes aspects such as any board(s) or graph(s) the game is played on, types of pieces or dice used in the game, and so on.

  3. 3.

    rules: describes rules used to (i) start the game (generate initial game state, e.g. by placing initial pieces on a board), (ii) play the game (generate lists of legal moves), and (iii) end the game (evaluate whether a state is terminal and determine the outcomes for the players).

Some of these aspects must be specified (such as the play rules), whereas others may be omitted if unnecessary (e.g., start rules are unnecessary in games that start with an empty board) or if they have a suitable default value (e.g., Ludii assumes a default number of players of 2222 if left unspecified). L-GDL includes a relatively large set of ludemes, many of which encapsulate relatively high-level concepts in keywords that game designers can easily understand and use to write and read game descriptions. Piette et al. [6] provide more detailed information on the Ludii system, and Browne et al. [15] provide a complete, detailed language reference for L-GDL.

A full example description for the game of Tic-Tac-Toe is presented in Figure 2. In this example, the equipment used to play the game is defined as a square board of size 3333 (by default using a tiling of square cells), a “Disc” piece type used by player 1, and a “Cross” piece type used by player 2. The subtree of ludemes (move Add (to (sites Empty))) describes that the set of legal moves consists of moves that add a piece to any site in the set of empty sites. The subtree (if (is Line 3) (result Mover Win)) describes the end condition of this game, which is that the current mover wins if they complete a contiguous line consisting of 3 of their pieces.

III From Extensive-Form Games to L-GDL

Given any arbitrary finite, extensive-form game 𝒢=𝒫,𝒯,𝒰,ι,𝒟,𝒢𝒫𝒯𝒰𝜄𝒟\mathcal{G}=\langle\mathcal{P},\mathcal{T},\mathcal{U},\iota,\mathcal{D},% \mathcal{I}\ranglecaligraphic_G = ⟨ caligraphic_P , caligraphic_T , caligraphic_U , italic_ι , caligraphic_D , caligraphic_I ⟩ as defined in Definition 1, we describe how a corresponding Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT can be modelled in L-GDL. In Section IV, we formally state and prove the theorem that 𝒢𝒢\mathcal{G}caligraphic_G and 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT form equivalent game trees with one-to-one correspondences between the set of all possible trajectories in 𝒢𝒢\mathcal{G}caligraphic_G and the set of all possible trajectories in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT. For simplicity, and without loss of generality, we make several assumptions about 𝒢𝒢\mathcal{G}caligraphic_G:

Assumption 1.

𝒢𝒢\mathcal{G}caligraphic_G has a unique initial game state s0subscript𝑠0s_{0}italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT as root node of its game tree.

This assumption is without loss of generality because a game with multiple distinct possibilities for the initial game state can be equivalently modelled as a game with a single chance node as root, with appropriate probabilities assigned for all the intended “real” initial game states.

Assumption 2.

If the root node of 𝒢𝒢\mathcal{G}caligraphic_G is not a chance node, the player labelled as 1111 will be the first player to make a move.

This assumption is without loss of generality because there is otherwise no particular meaning to the labels that are assigned to players.

(game "Game Name"
(players monospace-…\dotstypewriter_…)
(equipment {
monospace-…\dotstypewriter_…
})
(rules
(start monospace-…\dotstypewriter_…)
(play monospace-…\dotstypewriter_…)
(end monospace-…\dotstypewriter_…)
)
)
Figure 1: Basic structure of an L-GDL game description for Ludii. Note that curly braces are used for arrays in L-GDL.
(game "Tic-Tac-Toe"
(players 2222)
(equipment {
(board (square 3))
(piece "Disc" P1)
(piece "Cross" P2)
})
(rules
(play (move Add (to (sites Empty))))
(end (if (is Line 3) (result Mover Win)))
)
)
Figure 2: Full L-GDL description for the game of Tic-Tac-Toe.

The following subsections describe how to fill in the basic template L-GDL description from Figure 1 to construct such a Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT. The intuition behind our approach is similar to that of the proof by Piette et al. [6] (which was restricted to deterministic, perfect-information settings) in the sense that we explicitly enumerate the entire game tree of 𝒢𝒢\mathcal{G}caligraphic_G as a graph that the players play on by moving stones along a path from the root to any leaf. The most significant change is that, to support imperfect-information settings, we now use multiple “copies” of such a graph, with sets of possibly more than one stone per player moving down each player’s respective tree to track the information sets (rather than individual states) that players navigate between. As an example, a full game description file for the Monty Hall problem, described as explained in the following five subsections, is provided in the Ludii github repository.111https://github.com/Ludeme/Ludii/blob/master/Common/res/lud/test/dennis/MontyHallProblemExtensiveForm.lud This problem involves partial observability and stochasticity.

III-A Defining the Players

For a k𝑘kitalic_k-player extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G with players 𝒫={1,2,,k,η}𝒫12𝑘𝜂\mathcal{P}=\{1,2,\dots,k,\eta\}caligraphic_P = { 1 , 2 , … , italic_k , italic_η }, the set of players in Ludii can simply be defined as (players k). It is not necessary to explicitly define the nature player in Ludii. The player labelled as player 1111 in Ludii will, by default, be the first player to make a move, matching Assumption 2.

III-B Defining the Equipment

Firstly, we define a neutral Marker0 piece type—which we use to keep track of the true game state that we are in during any given trajectory of play—as well as one MarkerP piece type for every player 1Pk1𝑃𝑘1\leq P\leq k1 ≤ italic_P ≤ italic_k—which are used to reveal the correct information set to each player. This equipment is defined in the equipment({monospace-…\dotstypewriter_…}) section of the game description using (piece "Marker" Neutral) and (piece "Marker" Each).

Secondly, we construct the game board by defining a graph that contains (k+1)×|𝒮|𝑘1𝒮(k+1)\times|\mathcal{S}|( italic_k + 1 ) × | caligraphic_S | vertices. These may be thought of as representing (k+1)𝑘1(k+1)( italic_k + 1 ) copies of the game tree 𝒯𝒯\mathcal{T}caligraphic_T in 𝒢𝒢\mathcal{G}caligraphic_G, with |𝒮|𝒮|\mathcal{S}|| caligraphic_S | vertices per copy, although it is not necessary to also include the connectivity structure (i.e., the edges of the tree) in this graph. Hence, the game board consists of one large graph, which contains separate graph representations of the full game tree for each player (including the neutral player). Such a graph can be constructed manually using (graph vertices:{monospace-…\dotstypewriter_…}). Let i𝑖iitalic_i denote the unique index of a state si𝒮subscript𝑠𝑖𝒮s_{i}\in\mathcal{S}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ caligraphic_S. Then, in the graph for player p𝑝pitalic_p (assume p=0𝑝0p=0italic_p = 0 for the nature player), the index of the node that corresponds to sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is given by p×|𝒮|+i𝑝𝒮𝑖p\times|\mathcal{S}|+iitalic_p × | caligraphic_S | + italic_i. Without loss of generality, we assume that the index of the initial game state is 00.

Thirdly, for every state si𝒮subscript𝑠𝑖𝒮s_{i}\in\mathcal{S}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ caligraphic_S and every player 1pk1𝑝𝑘1\leq p\leq k1 ≤ italic_p ≤ italic_k, we define a region in the equipment that contains all the indices of the vertices corresponding to states that are in the information set of p𝑝pitalic_p when the true state is sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. More formally, for all 0i<|𝒮|0𝑖𝒮0\leq i<|\mathcal{S}|0 ≤ italic_i < | caligraphic_S | and all 1pk1𝑝𝑘1\leq p\leq k1 ≤ italic_p ≤ italic_k, we define a region named "InformationSet_i_p" containing all the indices p×|𝒮|+j𝑝𝒮𝑗p\times|\mathcal{S}|+jitalic_p × | caligraphic_S | + italic_j for all j{jsj(p,si)}𝑗conditional-set𝑗subscript𝑠𝑗𝑝subscript𝑠𝑖j\in\{j\mid s_{j}\in\mathcal{I}(p,s_{i})\}italic_j ∈ { italic_j ∣ italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∈ caligraphic_I ( italic_p , italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) }. Such a region can be defined in a game description using (regions "InformationSet_i_p" {monospace-…\dotstypewriter_…}). Whenever the true state is sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, this region allows us to easily access all the vertices corresponding to the complete information set for any given player p𝑝pitalic_p.

Fourthly, for every player 1pk1𝑝𝑘1\leq p\leq k1 ≤ italic_p ≤ italic_k, we define a region in the equipment named "Subgraph_p" that contains all the indices of the vertices in that player’s respective subgraph, i.e. all indices in {jp×|𝒮|j<(p+1)×|𝒮|}conditional-set𝑗𝑝𝒮𝑗𝑝1𝒮\{j\mid p\times|\mathcal{S}|\leq j<(p+1)\times|\mathcal{S}|\}{ italic_j ∣ italic_p × | caligraphic_S | ≤ italic_j < ( italic_p + 1 ) × | caligraphic_S | }. Such a region can be defined in a game description using (regions "Subgraph_p" {monospace-…\dotstypewriter_…}). We similarly define a region "Subgraph_0" for the first subgraph.

Note that the definitions of piece types, graphs, and regions as detailed above do not yet have many semantics associated with them. These statements largely serve to declare the existence of various types of data, such that they may be referenced (by their names) and used in the definitions of rules as described in the subsequent subsections. Figure 3 provides a template for an equipment definition following the steps that were just listed.

monospace-…\dotstypewriter_…
(equipment {
(piece "Marker" Neutral)
(piece "Marker" Each)
(board
(graph
vertices:{
// Vertices for tracking game state
{x1y1subscript𝑥1subscript𝑦1x_{1}\;y_{1}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT} monospace-…\dotstypewriter_… {x|𝒮|y|𝒮|subscript𝑥𝒮subscript𝑦𝒮x_{|\mathcal{S}|}\;y_{|\mathcal{S}|}italic_x start_POSTSUBSCRIPT | caligraphic_S | end_POSTSUBSCRIPT italic_y start_POSTSUBSCRIPT | caligraphic_S | end_POSTSUBSCRIPT}
// Vertices for tracking first infoset
{x1y1subscript𝑥1subscript𝑦1x_{1}\;y_{1}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT} monospace-…\dotstypewriter_… {x|𝒮|y|𝒮|subscript𝑥𝒮subscript𝑦𝒮x_{|\mathcal{S}|}\;y_{|\mathcal{S}|}italic_x start_POSTSUBSCRIPT | caligraphic_S | end_POSTSUBSCRIPT italic_y start_POSTSUBSCRIPT | caligraphic_S | end_POSTSUBSCRIPT}
monospace-…\dotstypewriter_…
// Vertices for tracking kthsuperscript𝑘𝑡k^{th}italic_k start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT infoset
{x1y1subscript𝑥1subscript𝑦1x_{1}\;y_{1}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT} monospace-…\dotstypewriter_… {x|𝒮|y|𝒮|subscript𝑥𝒮subscript𝑦𝒮x_{|\mathcal{S}|}\;y_{|\mathcal{S}|}italic_x start_POSTSUBSCRIPT | caligraphic_S | end_POSTSUBSCRIPT italic_y start_POSTSUBSCRIPT | caligraphic_S | end_POSTSUBSCRIPT}
}
)
use:Vertex
)
// For every state and every player, an infoset
// listing all the possible states
(regions "InformationSet_0_1" {monospace-…\dotstypewriter_…})
monospace-…\dotstypewriter_…
(regions "InformationSet_|𝒮|𝒮|\mathcal{S}|| caligraphic_S |_1" {monospace-…\dotstypewriter_…})
(regions "InformationSet_0_2" {monospace-…\dotstypewriter_…})
monospace-…\dotstypewriter_…
(regions "InformationSet_|𝒮|𝒮|\mathcal{S}|| caligraphic_S |_k𝑘kitalic_k" {monospace-…\dotstypewriter_…})
// Each player has a copy of the tree
(regions "Subgraph_0" {0..<|𝒮|1𝒮1|\mathcal{S}|-1| caligraphic_S | - 1>})
(regions "Subgraph_1" {|𝒮|𝒮|\mathcal{S}|| caligraphic_S |..<2×|𝒮|12𝒮12\times|\mathcal{S}|-12 × | caligraphic_S | - 1>})
monospace-…\dotstypewriter_…
(regions "Subgraph_k𝑘kitalic_k" {<k×|𝒮|𝑘𝒮k\times|\mathcal{S}|italic_k × | caligraphic_S |>..<(k+1)×|𝒮|1𝑘1𝒮1(k+1)\times|\mathcal{S}|-1( italic_k + 1 ) × | caligraphic_S | - 1>})
})
monospace-…\dotstypewriter_…
Figure 3: Template for the equipment definition of a Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT, modelling an equivalent extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G with |𝒮|𝒮|\mathcal{S}|| caligraphic_S | different states and k𝑘kitalic_k players. The expressions angled brackets are used for generality, but would be replaced by the concrete result of the expression in any single concrete game description. The values used for x𝑥xitalic_x- and y𝑦yitalic_y-coordinates only affect display in Ludii’s graphical user interface, and are irrelevant in terms of semantics.

III-C Defining the Start Rules

Due to Assumption 1, we know that every player’s information set for the initial game state contains only s0subscript𝑠0s_{0}italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT; p(p,s0)={s0}subscriptfor-all𝑝𝑝subscript𝑠0subscript𝑠0\forall_{p}\mathcal{I}(p,s_{0})=\{s_{0}\}∀ start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT caligraphic_I ( italic_p , italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) = { italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT }. Hence, we start the game by placing a marker for each player (including a neutral marker for the nature player) on the vertex that represents the initial game state in each player’s respective subgraph in the board. For any player p𝑝pitalic_p, the index of this vertex is given by p×|𝒮|𝑝𝒮p\times|\mathcal{S}|italic_p × | caligraphic_S |, assuming p=0𝑝0p=0italic_p = 0 for the nature player. Presence or absence of markers on any site in a subgraph corresponding to a player p𝑝pitalic_p must be hidden from all other players ppsuperscript𝑝𝑝p^{\prime}\neq pitalic_p start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ≠ italic_p, to avoid leaking information that those other players should not have access to.

Start rules that accomplish this setup for the initial game state are provided in Figure 4. Each of the (place "Markerk𝑘kitalic_k" <x𝑥xitalic_x>) lines places a Marker for player k𝑘kitalic_k on site x𝑥xitalic_x, marking the information set that player k𝑘kitalic_k believes the game is in. In the initial state, every player’s information set contains only a single state, thanks to Assumption 1. The marker for k=0𝑘0k=0italic_k = 0 does not correspond to any particular player, but is used to mark the true game state. The ludeme (set Hidden (sites x𝑥xitalic_x) to:y𝑦yitalic_y) states that all sites in a region x𝑥xitalic_x are set to be hidden (i.e., unobservable) to player(s) y𝑦yitalic_y. The combination of all such lines in the figure ensures that the first copy of the game tree (with index 00) is hidden to all players, and every other copy is only observable by its respective player.

More formally, for any Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT with these start rules, the following statements hold in the initial game state:

  • There is a piece of type Marker0 (not owned by any player) on the vertex with index 0.

  • For every player index P[1,,k]𝑃1𝑘P\in[1,\dots,k]italic_P ∈ [ 1 , … , italic_k ], there is a piece of type MarkerP (owned by player P𝑃Pitalic_P) on the vertex with index P×|𝒮|𝑃𝒮P\times|\mathcal{S}|italic_P × | caligraphic_S |.

  • No pieces are placed other than those mentioned above.

  • All vertices and their contents in the region named "Subgraph_0" are set to be hidden to all players. This means that no player can observe that vertex 0 contains a Marker0 piece. Similarly, none of the players can observe that all other vertices in this region are empty.

  • For every player index P[1,,k]𝑃1𝑘P\in[1,\dots,k]italic_P ∈ [ 1 , … , italic_k ], and every other player index P[1,,k]superscript𝑃1𝑘P^{\prime}\in[1,\dots,k]italic_P start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∈ [ 1 , … , italic_k ], with PPsuperscript𝑃𝑃P^{\prime}\neq Pitalic_P start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ≠ italic_P, all vertices in any region named "Subgraph_P" are hidden from Psuperscript𝑃P^{\prime}italic_P start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT. This means that every player P𝑃Pitalic_P can only observe vertices (and markers placed on them) in the region named "Subgraph_P".

monospace-…\dotstypewriter_…
(start {
(place "Marker0" 00)
(place "Marker1" <1×|𝒮|1𝒮1\times|\mathcal{S}|1 × | caligraphic_S |>)
monospace-…\dotstypewriter_…
(place "Markerk𝑘kitalic_k" <k×|𝒮|𝑘𝒮k\times|\mathcal{S}|italic_k × | caligraphic_S |>)
(set Hidden
(sites "Subgraph_0") to:All)
(set Hidden
(sites "Subgraph_1") to:(player 2))
monospace-…\dotstypewriter_…
(set Hidden
(sites "Subgraph_1") to:(player k𝑘kitalic_k))
(set Hidden
(sites "Subgraph_2") to:(player 1))
(set Hidden
(sites "Subgraph_2") to:(player 3))
monospace-…\dotstypewriter_…
(set Hidden
(sites "Subgraph_2") to:(player k𝑘kitalic_k))
monospace-…\dotstypewriter_…
(set Hidden
(sites "Subgraph_k𝑘kitalic_k") to:(player k1𝑘1k-1italic_k - 1))
})
monospace-…\dotstypewriter_…
Figure 4: Start rules for a Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT, modelling an equivalent extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G, with k𝑘kitalic_k players. The expressions to compute vertex indices in angled brackets are used for generality, but would be replaced by the concrete result of the expression in any single concrete game description.

III-D Defining the Play Rules

The play rules in Ludii define how to generate a list of legal moves for any given current game state sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. In our 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT model, where we aim to replicate the structure of the game tree of the extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G, we may distinguish two primary cases:

  1. 1.

    If sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is a chance node, i.e. ι(si)=η𝜄subscript𝑠𝑖𝜂\iota(s_{i})=\etaitalic_ι ( italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) = italic_η, in Ludii a regular player will be in control because Ludii does not explicitly include a nature player. Hence, we should generate only a single legal move such that the player is forced to traverse the branch that the chance player would have picked in 𝒢𝒢\mathcal{G}caligraphic_G. This can be accomplished by using the (random {monospace-…\dotstypewriter_…} {monospace-…\dotstypewriter_…}) ludeme, where the first array contains a sequence of n𝑛nitalic_n weights, and the second array contains a sequence of n𝑛nitalic_n move-generating ludemes, for a chance node with n𝑛nitalic_n possible branches. For example, (random { p𝑝pitalic_p, q𝑞qitalic_q, r𝑟ritalic_r } { A B C }) randomly selects one of the ludemes A, B, or C to generate the list of legal moves, with probabilities pp+q+r𝑝𝑝𝑞𝑟\frac{p}{p+q+r}divide start_ARG italic_p end_ARG start_ARG italic_p + italic_q + italic_r end_ARG, qp+q+r𝑞𝑝𝑞𝑟\frac{q}{p+q+r}divide start_ARG italic_q end_ARG start_ARG italic_p + italic_q + italic_r end_ARG, or rp+q+r𝑟𝑝𝑞𝑟\frac{r}{p+q+r}divide start_ARG italic_r end_ARG start_ARG italic_p + italic_q + italic_r end_ARG, respectively. The appropriate weights to use can be derived from the nonzero probabilities 𝒟(s,s)𝒟𝑠superscript𝑠\mathcal{D}(s,s^{\prime})caligraphic_D ( italic_s , italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) as specified in 𝒢𝒢\mathcal{G}caligraphic_G.

  2. 2.

    If sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is not a chance node, i.e. ι(si)η𝜄subscript𝑠𝑖𝜂\iota(s_{i})\neq\etaitalic_ι ( italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ≠ italic_η, the mover ι(si)𝜄subscript𝑠𝑖\iota(s_{i})italic_ι ( italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) should have one move corresponding to every branch from sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT in the game tree of the extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G. This can be implemented using an (or { monospace-…\dotstypewriter_… }) ludeme that wraps around other ludemes, each of which generates one of the legal moves.

Without any knowledge of any general rules that may determine how legal moves are computed from a game state sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT in the extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G, it is necessary to explicitly enumerate all game states and define the play rules separately per state. One way to accomplish this is by using a chain of (if C A B) ludemes, where:

  • C is a condition of the form (= (where "Marker" Neutral) i): this checks whether the Marker0 piece is located on vertex i𝑖iitalic_i, and can hence be used to determine whether or not the current game state is sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT.

  • A is a ludeme that generates the moves in the case that the condition of C is satisfied by the current game state (i.e., if the current game state is sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT).

  • B is a ludeme that generates the moves if the current game state does not satisfy the condition of C; this can again be a ludeme of the same (if C A B) form.

Suppose that there is some branch in the extensive-form game tree of 𝒢𝒢\mathcal{G}caligraphic_G that leads from a state sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to a state sjsubscript𝑠𝑗s_{j}italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. In the corresponding Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT, we require a corresponding move that has the following effects on the game state:

  1. 1.

    It should move the Marker0 piece, which should currently be located on the vertex with index i𝑖iitalic_i, to the vertex with index j𝑗jitalic_j. This enables us to continue tracking the true game state.

  2. 2.

    For every player 1pk1𝑝𝑘1\leq p\leq k1 ≤ italic_p ≤ italic_k, any Markerp𝑝pitalic_p pieces currently on the board should be removed, and new Markerp𝑝pitalic_p pieces should be placed on all vertices in the InformationSet_j𝑗jitalic_j_p𝑝pitalic_p region. This enables us to let every player know which information set it transitioned into.

  3. 3.

    By default, Ludii reveals information about positions that become empty. Because the above effects remove some pieces from positions that should still remain hidden from many players, vertices should be appropriately set to hidden again as they were originally set in the start rules.

  4. 4.

    By default, Ludii updates the index of which player is designated the mover after every move, by incrementing it or resetting it to 1111 after player k𝑘kitalic_k made a move. If this results in a different player to move than the player ι(sj)𝜄subscript𝑠𝑗\iota(s_{j})italic_ι ( italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) that should become the mover in sjsubscript𝑠𝑗s_{j}italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, we need to include an extra effect in the move that correctly sets the player to move. Note that, if ι(sj)=η𝜄subscript𝑠𝑗𝜂\iota(s_{j})=\etaitalic_ι ( italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) = italic_η in 𝒢𝒢\mathcal{G}caligraphic_G, it does not matter which player is set to be the mover in Ludii, since we only generate one legal move anyway that whichever player is the mover will be forced to pick.

Suppose that such a state sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT has n𝑛nitalic_n legal moves. A straightforward way to present n𝑛nitalic_n different options to the player ι(si)𝜄subscript𝑠𝑖\iota(s_{i})italic_ι ( italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) is to allow them to select one out of any of vertex 0v<n0𝑣𝑛0\leq v<n0 ≤ italic_v < italic_n, and to specify appropriate consequences for each of those “select” moves. These consequences should correspond to the vthsuperscript𝑣𝑡v^{th}italic_v start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT branch from sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT in the game tree of 𝒢𝒢\mathcal{G}caligraphic_G, but otherwise do not necessarily have any particular relationship with the specific vertex v𝑣vitalic_v; selecting vertices is simply a mechanism through which the player can distinguish between n𝑛nitalic_n different moves.

Figure 5 depicts the specification of a move rule for a single transition from sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to sjsubscript𝑠𝑗s_{j}italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. The (move Select (from n𝑛nitalic_n) (then monospace-…\dotstypewriter_…)) ludeme defines a legal move where the player may opt to select a vertex n𝑛nitalic_n, which will lead to consequences as defined inside the (then monospace-…\dotstypewriter_…) ludeme. These consequences correspond to the four types of effects listed previously. The marker tracking the true game state (hidden to all players) is moved by (fromTo (from i𝑖iitalic_i) (to j𝑗jitalic_j)). The (remove (sites Occupied by:Pk𝑘kitalic_k)) ludemes each remove all markers for one player k𝑘kitalic_k from the board, and each of the (add (piece k+1𝑘1k+1italic_k + 1) (to (sites "InformationSet_j𝑗jitalic_j_k𝑘kitalic_k"))) ludemes similarly places new markers to mark the new information set for a player k𝑘kitalic_k. Note that there is an offset of +11+1+ 1 due to the presence of the neutral piece in the game. As in Figure 4, the (set Hidden monospace-…\dotstypewriter_…) ludemes ensure that no player can observe any information they should not be able to. Finally, the (set NextPlayer (player ι𝜄\iotaitalic_ι(sjsubscript𝑠𝑗s_{j}italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT))) ludeme ensures that the correct player to move is set in the subsequent game state.

monospace-…\dotstypewriter_…
(move Select (from n𝑛nitalic_n)
(then (and {
(fromTo (from i𝑖iitalic_i) (to j𝑗jitalic_j))
(remove (sites Occupied by:P1))
(remove (sites Occupied by:P2))
monospace-…\dotstypewriter_…
(remove (sites Occupied by:Pk𝑘kitalic_k))
(add (piece 2)
(to (sites "InformationSet_j𝑗jitalic_j_1")))
(add (piece 3)
(to (sites "InformationSet_j𝑗jitalic_j_2")))
monospace-…\dotstypewriter_…
(add (piece k+1𝑘1k+1italic_k + 1)
(to (sites "InformationSet_j𝑗jitalic_j_k𝑘kitalic_k")))
(set Hidden
(sites "Subgraph_0") to:All)
(set Hidden
(sites "Subgraph_1") to:(player 2))
monospace-…\dotstypewriter_…
(set Hidden
(sites "Subgraph_1") to:(player k𝑘kitalic_k))
(set Hidden
(sites "Subgraph_2") to:(player 1))
(set Hidden
(sites "Subgraph_2") to:(player 3))
monospace-…\dotstypewriter_…
(set Hidden
(sites "Subgraph_2") to:(player k𝑘kitalic_k))
monospace-…\dotstypewriter_…
(set Hidden
(sites "Subgraph_k𝑘kitalic_k") to:(player k1𝑘1k-1italic_k - 1))
(set NextPlayer (player ι(sj)𝜄subscript𝑠𝑗\iota(s_{j})italic_ι ( italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT )))
}))
)
monospace-…\dotstypewriter_…
Figure 5: Ludeme generating a move corresponding to the nthsuperscript𝑛𝑡n^{th}italic_n start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT branch from a state sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, leading to a state sjsubscript𝑠𝑗s_{j}italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, in the game tree of an extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G with k𝑘kitalic_k players. The player that should be the mover in the next state sjsubscript𝑠𝑗s_{j}italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is denoted by ι(sj)𝜄subscript𝑠𝑗\iota(s_{j})italic_ι ( italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT )—except we replace it by any arbitrary integer in [1,k]1𝑘[1,k][ 1 , italic_k ] if ι(sj)=η𝜄subscript𝑠𝑗𝜂\iota(s_{j})=\etaitalic_ι ( italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) = italic_η.

III-E Defining the End Rules

For each of the terminal game states st𝒮tersubscript𝑠𝑡subscript𝒮𝑡𝑒𝑟s_{t}\in\mathcal{S}_{ter}italic_s start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ∈ caligraphic_S start_POSTSUBSCRIPT italic_t italic_e italic_r end_POSTSUBSCRIPT in 𝒢𝒢\mathcal{G}caligraphic_G, we can define a separate end rule in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT that checks whether that specific state has been reached by tracking the position of the Marker0 piece, and assigns a vector of payoffs to the k𝑘kitalic_k players as given by 𝒰(st)𝒰subscript𝑠𝑡\mathcal{U}(s_{t})caligraphic_U ( italic_s start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) using the payoffs ludeme. Figure 6 provides an example of such end rules for an example game for k=3𝑘3k=3italic_k = 3 players with two terminal game states.

(end {
(if (= (where "Marker" Neutral) 88)
(payoffs {
(payoff P1 -1)
(payoff P2 0.5)
(payoff P3 1)
})
)
(if (= (where "Marker" Neutral) 2077)
(payoffs {
(payoff P1 10)
(payoff P2 12)
(payoff P3 2020)
})
)
})
Figure 6: Example end rules for an example game with k=3𝑘3k=3italic_k = 3 players, where states s88subscript𝑠88s_{88}italic_s start_POSTSUBSCRIPT 88 end_POSTSUBSCRIPT and s2077subscript𝑠2077s_{2077}italic_s start_POSTSUBSCRIPT 2077 end_POSTSUBSCRIPT are terminal states, with payoff vectors of [1,0.5,1]10.51[-1,0.5,1][ - 1 , 0.5 , 1 ] and [10,12,2020]10122020[10,12,2020][ 10 , 12 , 2020 ], respectively.

In the end rules, a ludeme of the form (if (A) (payoffs monospace-…\dotstypewriter_…)) ensures that, as soon as a game state is reached where the condition (A) holds, the game terminates and payoffs are assigned to all players as per the (payoffs monospace-…\dotstypewriter_…) ludeme. A condition of the form (= (where "Marker" Neutral) x𝑥xitalic_x), as used in Figure 6, is true in any game state where there is a piece of type Marker0 on the vertex with index x𝑥xitalic_x. Given the construction of the start and play rules described previously, this means that we check whether we are in the state meant to represent state sxsubscript𝑠𝑥s_{x}italic_s start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT from the original extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G. A ludeme of the form (payoffs (payoff P1 x𝑥xitalic_x) (payoff P2 y𝑦yitalic_y) (payoff P3 z𝑧zitalic_z)) assigns payoffs of x𝑥xitalic_x, y𝑦yitalic_y, and z𝑧zitalic_z, to the first, second, and third player, respectively.

IV Proof of Equivalence

Based on the strategy for constructing a Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT for any extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G as described above, we present Theorem 1, which may intuitively be understood as stating that it is possible to model any arbitrary finite extensive-form game in L-GDL.

Theorem 1.

Under Assumptions 1 and 2, for any arbitrary extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G, a corresponding Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT constructed as described in Subsections III-AIII-E, is equivalent to 𝒢𝒢\mathcal{G}caligraphic_G in the sense that the following criteria are satisfied:

  1. 1.

    The game description of 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT is a valid game description according to the specification of L-GDL’s grammar [15].

  2. 2.

    There exists a one-to-one correspondence between trajectories from the root node to any possible leaf node in the game tree of 𝒢𝒢\mathcal{G}caligraphic_G, and trajectories of play that are possible from the initial game state in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT. More concretely, this means that:

    1. (a)

      For every node s𝑠sitalic_s that is reachable from the root node s0subscript𝑠0s_{0}italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, including s0subscript𝑠0s_{0}italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT itself, there exists an equivalent game state in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT that is also reachable in the same number of transitions from the initial game state of 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT.

    2. (b)

      For every node s𝑠sitalic_s in the game tree of 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT where ι(s)η𝜄𝑠𝜂\iota(s)\neq\etaitalic_ι ( italic_s ) ≠ italic_η (i.e., any node that is not a chance node), the equivalent state in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT also has ι(s)𝜄𝑠\iota(s)italic_ι ( italic_s ) as the player to move.

    3. (c)

      For every node s𝑠sitalic_s in the game tree of 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT where ι(s)η𝜄𝑠𝜂\iota(s)\neq\etaitalic_ι ( italic_s ) ≠ italic_η, if there are n𝑛nitalic_n branches to n𝑛nitalic_n successors, there are also n𝑛nitalic_n legal moves in the equivalent state in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT.

    4. (d)

      For any chance node s𝑠sitalic_s that is reachable from the root node s0subscript𝑠0s_{0}italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT of the game tree of 𝒢𝒢\mathcal{G}caligraphic_G, for every possible ssuperscript𝑠s^{\prime}italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT that has a probability 𝒟(s,s)>0𝒟𝑠superscript𝑠0\mathcal{D}(s,s^{\prime})>0caligraphic_D ( italic_s , italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) > 0 of being the successor of s𝑠sitalic_s, there is also a probability 𝒟(s,s)𝒟𝑠superscript𝑠\mathcal{D}(s,s^{\prime})caligraphic_D ( italic_s , italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) that a transition to the equivalent state of ssuperscript𝑠s^{\prime}italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT is the only legal transition in any arbitrary trajectory that reaches the equivalent of s𝑠sitalic_s in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT.

    5. (e)

      For any terminal node s𝒮ter𝑠subscript𝒮𝑡𝑒𝑟s\in\mathcal{S}_{ter}italic_s ∈ caligraphic_S start_POSTSUBSCRIPT italic_t italic_e italic_r end_POSTSUBSCRIPT in the game tree of 𝒢𝒢\mathcal{G}caligraphic_G, the equivalent state in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT is also terminal, and assigns the same vector of payoffs 𝒰(s)𝒰𝑠\mathcal{U}(s)caligraphic_U ( italic_s ).

  3. 3.

    Any player 1pk1𝑝𝑘1\leq p\leq k1 ≤ italic_p ≤ italic_k playing the Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT cannot distinguish between any pair of states that are the equivalents of two distinct nodes s𝑠sitalic_s, ssuperscript𝑠s^{\prime}italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT if and only if they share the same information set (p,s)=(p,s)𝑝𝑠𝑝superscript𝑠\mathcal{I}(p,s)=\mathcal{I}(p,s^{\prime})caligraphic_I ( italic_p , italic_s ) = caligraphic_I ( italic_p , italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ).

These criteria are similar to those used for the proof of universality for S-GDL [11].

Proof.

By construction, the game description as detailed in subsections III-A to III-E is a valid L-GDL description. As of the public v1.1.17 release of Ludii—which first introduced the (random monospace-…\dotstypewriter_…) and (payoffs monospace-…\dotstypewriter_…) ludemes—all of the ludemes used are supported. This satisfies criterion 1.

The start rules of 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT (see Figure 4) ensure that, in the initial game state, a piece of type Marker0 is placed on vertex 00, and not on any other position. All moves that can possibly be generated are of the form depicted in Figure 5, which can only affect the positions of Marker0 pieces through its (fromTo (from i𝑖iitalic_i) (to j𝑗jitalic_j)) rule, which moves whichever piece is at vertex i𝑖iitalic_i to vertex j𝑗jitalic_j. This means that the number of Marker0 pieces cannot change; there must always be one, and only its position can change due to (fromTo (from i𝑖iitalic_i) (to j𝑗jitalic_j)) rules. For any particular value of i𝑖iitalic_i, such a rule is only used in situations that satisfy the (= (where "Marker" Neutral) i) condition, i.e. only if vertex i𝑖iitalic_i currently contains the sole Marker0 piece. For any pair of values i𝑖iitalic_i and j𝑗jitalic_j, if there is a branch from sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to sjsubscript𝑠𝑗s_{j}italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT in the game tree of 𝒢𝒢\mathcal{G}caligraphic_G, it is also possible for there to be a legal move that moves the Marker0 piece from vertex i𝑖iitalic_i to vertex j𝑗jitalic_j in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT; such a move is either legal for sure if sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is not a chance node, or legal with probability 𝒟(si,sj)𝒟subscript𝑠𝑖subscript𝑠𝑗\mathcal{D}(s_{i},s_{j})caligraphic_D ( italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) if sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is a chance node. This satisfies criterion 2a; the equivalent state of a node sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT can always be identified as the one that has the Marker0 piece on vertex i𝑖iitalic_i.

The move rules as described in Figure 5 have, by construction, been set up to ensure that the next player to move is set to ι(sj)𝜄subscript𝑠𝑗\iota(s_{j})italic_ι ( italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT )—or any arbitrary integer in [1,k]1𝑘[1,k][ 1 , italic_k ] if ι(sj)=η𝜄subscript𝑠𝑗𝜂\iota(s_{j})=\etaitalic_ι ( italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) = italic_η—whenever a move is made that moves the Marker0 piece to vertex j𝑗jitalic_j—which means that the equivalent state of a node sjsubscript𝑠𝑗s_{j}italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is reached. This ensures that criterion 2b is satisfied for every node except for the root node s0subscript𝑠0s_{0}italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. Assumption 2 ensures that the criterion is also satisfied for s0subscript𝑠0s_{0}italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT.

By construction, as described in Subsection III-D, for every node sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT that is not a chance node, the equivalent state in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT has its move rules defined by an (or { monospace-…\dotstypewriter_… }) rule that wraps around n𝑛nitalic_n different rules, each of which generates exactly 1111 legal move, such that n𝑛nitalic_n is the number of successors of sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT in the game tree of 𝒢𝒢\mathcal{G}caligraphic_G. This satisfies criterion 2c. Similarly, the correct number of moves with correct probabilities 𝒟(s,s)𝒟𝑠superscript𝑠\mathcal{D}(s,s^{\prime})caligraphic_D ( italic_s , italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) as required by 2d are explicitly defined as described in Subsection III-D.

The end rules as described in Subsection III-E explicitly detect any game state in the Ludii game 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT that is the equivalent of a terminal node s𝒮ter𝑠subscript𝒮𝑡𝑒𝑟s\in\mathcal{S}_{ter}italic_s ∈ caligraphic_S start_POSTSUBSCRIPT italic_t italic_e italic_r end_POSTSUBSCRIPT of the extensive-form game 𝒢𝒢\mathcal{G}caligraphic_G, and explicitly assign the corresponding payoffs vector 𝒰(s)𝒰𝑠\mathcal{U}(s)caligraphic_U ( italic_s ). This satisfies criterion 2e.

By Assumption 1, there is only a single initial game state, and every player is aware of that. Therefore, every player’s information set for the root node contains only the root node; p{1,,k}(p,s0)={s0}subscriptfor-all𝑝1𝑘𝑝subscript𝑠0subscript𝑠0\forall_{p\in\{1,\dots,k\}}\mathcal{I}(p,s_{0})=\{s_{0}\}∀ start_POSTSUBSCRIPT italic_p ∈ { 1 , … , italic_k } end_POSTSUBSCRIPT caligraphic_I ( italic_p , italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) = { italic_s start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT }. This is reflected by the start rules described in Subsection III-C which, for every player p𝑝pitalic_p, place a marker for that player—and only visible to that player—in the subgraph used to represent the state space of 𝒢𝒢\mathcal{G}caligraphic_G for that player. Every move that can be applied in any trajectory is of the form illustrated by Figure 5, which ensures that:

  1. 1.

    Every player p𝑝pitalic_p can only ever observe markers on vertices of “its own” subgraph.

  2. 2.

    Let j𝑗jitalic_j denote the vertex that contains the neutral marker—hidden from all players—in the first subgraph. For every player p𝑝pitalic_p, within that player’s “own” subgraph, there is always a marker on every vertex that represents any of the nodes in the information set (p,sj)𝑝subscript𝑠𝑗\mathcal{I}(p,s_{j})caligraphic_I ( italic_p , italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) for that player in that state.

This means that, for any pair of nodes that is in the same information set for a player in the game tree of 𝒢𝒢\mathcal{G}caligraphic_G, the pair of equivalent game states in 𝒢Lsuperscript𝒢𝐿\mathcal{G}^{L}caligraphic_G start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT are also indistinguishable from each other from that player’s perspective (due to the arrangement of markers on vertices visible to that player being identical). Note that the move rules as described in Figure 5 were deliberately set up such that players always select vertex n𝑛nitalic_n to pick the nthsuperscript𝑛𝑡n^{th}italic_n start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT move in a list of legal moves, irrespective of which vertices are subsequently affected by that move. It might have been more intuitive to directly select the vertex corresponding to the node in the extensive-form game tree to transition into, but this could reveal additional information that the player should not have access to. With this, criterion 3 is also satisfied and the proof is complete. ∎

V Discussion

The main topic of this paper, with Theorem 1 and its proof, is to prove that L-GDL is sufficiently expressive to model the equivalent of any arbitrary finite extensive-form game. A related question of potential interest is the converse of Theorem 1: is any game that can be modelled in L-GDL equivalent to a finite extensive-form game? This question can be answered in the negative with counterexamples. For example, the game of Mu Torere (which has been implemented in Ludii) is known to go on indefinitely under perfect play [16], which makes it an example of a game with an infinitely-sized game tree that can be implemented in L-GDL. Hence, while L-GDL is sufficiently expressive to model any game of the class considered in Theorem 1, it is not restricted to that class.

VI Conclusion

Ludii’s game description language (L-GDL) has primarily been designed to be easy to use for game designers, with a focus on facilitating the design of board games and similar abstract games. In practice, its count of over 1000 distinct game descriptions222https://ludii.games/library.php (which far exceeds the game counts in official repositories of many other systems with GDLs, such as S-GDL [2, 3], RBG [4], and GVGAI [8]) has already demonstrated its flexibility and generality. In this paper, we have also proven its generality from a theoretical angle, demonstrating that it is possible to write an equivalent game in L-GDL for any arbitrary finite extensive-form game [12]. Two assumptions (Assumptions 1 and 2) on the structure of extensive-form games were made to simplify the proof, but both assumptions are without loss of generality. Simultaneous-move games were not considered explicitly, but are implicitly also covered by the proof due to the possibility of modelling any simultaneous-move game as a sequential one with hidden information [14]. This provides a significant extension of an earlier proof [6] by including stochastic and imperfect-information games (and, implicitly, also simultaneous-move games), and means that the expressiveness of L-GDL matches that proven by Thielscher [11] for S-GDL.

This result suggests that we can opt to use Ludii over S-GDL in GGP research for some of its other advantages, such as computational efficiency [6] and ease of use, without a loss in expressiveness. While the somewhat convoluted way of defining games used for the theoretical proof is unlikely to be an efficient way of implementing many “real” games in practice, it may be a fruitful starting point for designing synthetic game trees for targeted research into the relations between certain game tree characteristics and the effectiveness of different algorithms [17, 18] within the same framework and API (Ludii) that also supports many real games.

In this paper, we primarily focused on the expressiveness of the L-GDL language. This is one of the primary types of properties that is typically considered of importance for GDLs [11, 4]. However, there are also other interesting theoretical properties of GDLs and game descriptions, which may be further explored (for the case of L-GDL) in future work. For example, in future work it would be interesting to examine whether or not L-GDL is Turing complete, and what the complexity is of deciding whether or not any given L-GDL description satisfies certain properties such as playability or well-formedness [19].

Acknowledgment

This research is funded by the European Research Council as part of the Digital Ludeme Project (ERC Consolidator Grant #771292).

References

  • [1] J. Pitrat, “Realization of a general game-playing program,” in IFIP Congress (2), 1968, pp. 1570–1574.
  • [2] M. R. Genesereth, N. Love, and B. Pell, “General game playing: Overview of the AAAI competition,” AI Magazine, vol. 26, no. 2, pp. 62–72, 2005. [Online]. Available: http://www.aaai.org/ojs/index.php/aimagazine/article/view/1813
  • [3] N. Love, T. Hinrichs, D. Haley, E. Schkufza, and M. Genesereth, “General game playing: Game description language specification,” Stanford Logic Group, Tech. Rep. LG-2006-01, 2008.
  • [4] J. Kowalski, M. Maksymilian, J. Sutowicz, and M. Szykuła, “Regular boardgames,” in Proceedings of the 33rd AAAI Conference on Artificial Intelligence.   AAAI Press, 2019, pp. 1699–1706.
  • [5] C. Browne, M. Stephenson, É. Piette, and D. J. N. J. Soemers, “A practical introduction to the Ludii general game system,” in Advances in Computer Games. ACG 2019, ser. Lecture Notes in Computer Science, T. Cazenave, H. J. van den Herik, A. Saffidine, and I.-C. Wu, Eds., vol. 12516.   Springer, Cham, 2020, pp. 167–179.
  • [6] É. Piette, D. J. N. J. Soemers, M. Stephenson, C. F. Sironi, M. H. M. Winands, and C. Browne, “Ludii – the ludemic general game system,” in Proceedings of the 24th European Conference on Artificial Intelligence (ECAI 2020), ser. Frontiers in Artificial Intelligence and Applications, vol. 325.   IOS Press, 2020, pp. 411–418.
  • [7] T. Schaul, “An extensible description language for video games,” IEEE Transactions on Computational Intelligence and AI in Games, vol. 6, no. 4, pp. 325–331, Dec. 2014.
  • [8] D. Perez-Liebana, J. Liu, A. Khalifa, R. D. Gaina, J. Togelius, and S. M. Lucas, “General video game AI: A multitrack framework for evaluating agents, games, and content generation algorithms,” IEEE Transactions on Games, vol. 11, no. 3, pp. 195–214, 2019.
  • [9] M. Samvelyan, R. Kirk, V. Kurin, J. Parker-Holder, M. Jiang, E. Hambro, F. Petroni, H. Küttler, E. Grefenstette, and T. Rocktäschel, “Minihack the planet: A sandbox for open-ended reinforcement learning research,” in Advances in Neural Information Processing Systems, 2021.
  • [10] M. Thielscher, “A general game description language for incomplete information games,” in Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence.   AAAI, 2010, pp. 994–999.
  • [11] ——, “The general game playing description language is universal,” in Proceedings of the Twenty-second International Joint Conference on Artificial Intelligence, IJCAI-11, 2011, pp. 1107–1112.
  • [12] E. Rasmusen, Games and Information: An Introduction to Game Theory, 4th ed.   Oxford, England: Blackwell Publishing, 2007.
  • [13] C. Browne, “A class grammar for general games,” in Advances in Computer Games, ser. Lecture Notes in Computer Science, A. Plaat, W. Kosters, and J. van den Herik, Eds., vol. 10068, Leiden, 2016, pp. 167–182.
  • [14] J. Watson, Strategy: An Introduction to Game Theory, 3rd ed.   New York: W. W. Norton & Company, 2013.
  • [15] C. Browne, D. J. N. J. Soemers, É. Piette, M. Stephenson, and W. Crist, “Ludii language reference,” ludii.games/downloads/LudiiLanguageReference.pdf, 2020.
  • [16] M. Ascher, “Mu Torere: An analysis of a Maori game,” Mathematics Magazine, vol. 60, no. 2, pp. 90–100, 1987.
  • [17] R. Ramanujan, A. Sabharwal, and B. Selman, “Understanding sampling style adversarial search methods,” in Proceedings of the Twenty-Sixth Conference on Uncertainty in Artificial Intelligence, 2010, pp. 474–483.
  • [18] ——, “On the behaviour of UCT in synthetic search spaces,” in ICAPS 2011 Workshop on Monte-Carlo Tree Search: Theory and Applications, 2011.
  • [19] A. Saffidine, “The game description language is Turing complete,” IEEE Transactions on Computational Intelligence and AI in Games, vol. 6, no. 4, pp. 320–324, 2014.