Skip to content

Main content

Random Minimax Game Tree Test Case Generator

Generate a bounded complete fixed-branching game tree with seeded integer leaf utilities, retain preorder node IDs and portable tree JSON, and delegate alternating minimax alpha–beta evaluation; pruning counts are skipped immediate child branches, not skipped leaves or a game-playing guarantee.

Loading tool…

Description

Generate a bounded complete fixed-branching game tree with seeded integer leaf utilities, retain preorder node IDs and portable tree JSON, and delegate alternating minimax alpha–beta evaluation; pruning counts are skipped immediate child branches, not skipped leaves or a game-playing guarantee.

A graph uses vertices and edges to represent relationships. Direction, duplicate handling, indexing, and traversal order affect its interpretation; returning a constructed graph together with a witness or calculated answer helps verify an algorithm.

Generate a bounded complete fixed-branching game tree with seeded integer leaf utilities, retain preorder node IDs and portable tree JSON, and delegate alternating minimax alpha–beta evaluation; pruning counts are skipped immediate child branches, not skipped leaves or a game-playing guarantee.

When to use this tool

Use this generator to create reproducible minimax game tree test case cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply branchingFactor, depth, minimumLeafValue, maximumLeafValue, maximizing in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read rootId, nodes, leafCount, treeJson, result. Use the conventions below and keep answer-bearing fields separate when presenting an exercise.

Build a complete fixed-branching game tree to the requested depth, draw integer leaf payoffs, and delegate alpha-beta search with the selected maximizing convention. Return preorder IDs, nodes, serialized tree, and search result.1

Delegated operations used for this result: alpha beta. Their calculation or parsing conventions apply to the corresponding result fields.2

Input fieldMeaning and unitsAccepted input
branchingFactorBranching FactorRequired. Safe integer; minimum 2; maximum 6.
depthDepthRequired. Safe integer; minimum 0; maximum 8.
minimumLeafValueMinimum Leaf ValueRequired. Safe integer.
maximumLeafValueMaximum Leaf ValueRequired. Safe integer.
maximizingMaximizingRequired. Boolean.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
rootIdRoot IdRequired. Safe integer; exactly 0.
nodesNodesRequired. Array of Object; no unknown keys. or Object; no unknown keys.; minimum items 1; maximum items 1023.
leafCountLeaf CountRequired. Safe integer; minimum 1; maximum 512.
treeJsonTree JsonRequired. Text; minimum UTF-16 length 1; maximum UTF-16 length 65536.
resultResultRequired. Object; no unknown keys.
result.bestValueBest ValueRequired. Safe integer.
result.evaluatedLeavesEvaluated LeavesRequired. Safe integer; minimum 1; maximum 512.
result.prunedBranchesPruned BranchesRequired. Safe integer; minimum 0; maximum 1022.
randomnessReplay metadata: source is seed or context; seed is the normalized 32-bit seed or null for a context source.Required. Object; no unknown keys.
randomness.seedOptional numeric replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "branchingFactor": 2,
    "depth": 2,
    "minimumLeafValue": 0,
    "maximumLeafValue": 9,
    "maximizing": false,
    "seed": 42
  },
  "output": {
    "rootId": 0,
    "nodes": [
      {
        "id": 0,
        "depth": 0,
        "kind": "branch",
        "children": [
          1,
          4
        ]
      },
      {
        "id": 1,
        "depth": 1,
        "kind": "branch",
        "children": [
          2,
          3
        ]
      },
      {
        "id": 2,
        "depth": 2,
        "kind": "leaf",
        "value": 6
      },
      {
        "id": 3,
        "depth": 2,
        "kind": "leaf",
        "value": 4
      },
      {
        "id": 4,
        "depth": 1,
        "kind": "branch",
        "children": [
          5,
          6
        ]
      },
      {
        "id": 5,
        "depth": 2,
        "kind": "leaf",
        "value": 8
      },
      {
        "id": 6,
        "depth": 2,
        "kind": "leaf",
        "value": 6
      }
    ],
    "leafCount": 4,
    "treeJson": "{\"children\":[{\"children\":[{\"value\":6},{\"value\":4}]},{\"children\":[{\"value\":8},{\"value\":6}]}]}",
    "result": {
      "bestValue": 6,
      "evaluatedLeaves": 3,
      "prunedBranches": 1
    },
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • Leaf count is limited to 512. The tree is an abstract deterministic perfect-information model; sampled payoffs do not represent a game engine, stochastic outcomes, or strategic learning.
  • A replay requires the same complete input and implementation. Randomized construction does not guarantee uniform coverage of every feasible output; finite samples can repeat unless a distinct-selection rule is explicitly stated.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Minimax Game Tree Test Case Generator — tool.io

  2. Calculation or validation: game-search/alpha-beta — tool.io

Similar or alternative tools

  • Random Labeled Tree Topology Generator

    Generate recursive labeled trees by attaching each later supplied ID uniformly to an earlier ID, retaining degrees and connectivity; this is not uniform over labeled trees.

  • Random Minimum Spanning Tree Test Case Generator

    Generate a connected signed-integer-weight graph, delegate tree selection to the existing Kruskal calculation, and sum the selected weights exactly instead of inheriting its display rounding.