Game rule builder that provides internal DSL for describing game rules

Hierarchy

  • TGameRule

Constructors

Properties

boardConnectionGraph: number[][]

Board representation: a list of board location offsets represented by direction ids. Dagaz adopts an extended representation of the Mailbox pattern, an array-based offset board representation system.

Link

https://www.chessprogramming.org/Mailbox

directionNames: string[]

A list of direction names. Each index of this array is a numeric id of each direction.

gameOptions: GameBehaviorOptions
initialGamePosition: {}

A list of initial piece locations and piece objects.

Type declaration

    locationNames: string[]

    Board representation: a list of board location names. Each index of this array is a numeric id of each location.

    modes: number[]

    A list of priorities on the mode of moves.

    movements: {
        func: MovementDefinitionMethod;
        mode: number;
        params: string[];
        pieceType: number;
    }[]

    A list of movements or behavior of pieces

    pieces: {}

    A list of pieces' names and prices. Each property is a numeric id of each piece type.

    Type declaration

      playerNames: string[]

      A list of player names. Each index of this array is a numeric id of each player.

      plugins: Plugin[]
      repeat: number
      rotationallySymmetricDirections: number[][]

      A list of rotationally symmetric directions of players. Each index of this array is a numeric id of each player.

      turns: {
          modes: number[];
          player: number;
      }[]
      zones: {}

      A list of zones, the special areas composed of specified locations.

      Type declaration

        Methods

        • Define a location on the game board.

          Parameters

          • Rest ...locationConfig: {
                locationDelta: number[];
                name: string;
            }[]

          Returns TGameRule

        • Define how a piece moves or works (e.g. how it moves to another location, how it captures other pieces, etc.)

          Parameters

          • Rest ...movements: {
                func: MovementDefinitionMethod;
                mode: number;
                params: string[];
                pieceType: number;
            }[]

          Returns TGameRule

        • Define a piece.

          Parameters

          • __namedParameters: {
                name: string;
                price?: number;
                type: number;
            }
            • name: string
            • Optional price?: number
            • type: number

          Returns TGameRule

        • Define a player with his/her rotationally symmetric move-directions; e.g. When a chess player moves a pawn one square toward north, the other player recognizes the pawn moves "one square toward south." This is an example of the move-direction symmetry.

          Parameters

          • Rest ...playerConfig: {
                name: string;
                symmetry: number[];
            }[]

          Returns TGameRule

        • Define a turn.

          Parameters

          • __namedParameters: {
                modes: number[];
                player: number;
            }
            • modes: number[]
            • player: number

          Returns TGameRule

        • Define a special zone on the game board.

          Parameters

          • Rest ...zoneConfig: {
                locations: string[];
                name: string;
                player: number;
            }[]

          Returns TGameRule

        • Define some flags for game rules and store them into the global namespace

          Parameters

          • gameOptions: Partial<GameBehaviorOptions> = {}

          Returns TGameRule

        • Define a initial setup of pieces.

          Parameters

          • Rest ...initialPiecePlacementConfig: {
                locations: string[];
                pieceName: string;
                player: string;
            }[]

          Returns TGameRule

        Generated using TypeDoc