jevrecipes

Recipe catalog / checkers-move

Choose a checkers move

Recommend a supplied legal checkers move from a structured board and player, with built-in American/English checkers instructions.

Your checkers game already provides its board, acting player, and legal moves, and you want a move ID without writing decision prompts.

Explore this recipe interactively ยท Source and implementation guide

Use checkers-move in TypeScript

Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.

import { checkersMove } from 'jev-recipes/checkers-move';

const result = await checkersMove({
  "board": [
    {
      "square": "c3",
      "player": "red"
    },
    {
      "square": "b4",
      "player": "black"
    },
    {
      "square": "d4",
      "player": "black"
    },
    {
      "square": "f6",
      "player": "black",
      "king": true
    }
  ],
  "player": "red",
  "legalMoves": [
    {
      "id": "capture-left",
      "from": "c3",
      "path": [
        "a5"
      ],
      "captures": [
        "b4"
      ]
    },
    {
      "id": "capture-right",
      "from": "c3",
      "path": [
        "e5",
        "g7"
      ],
      "captures": [
        "d4",
        "f6"
      ]
    }
  ]
});
console.log(result);

Input contract

FieldTypeNeeded
boardarrayRequired
playerred | blackRequired
legalMovesarrayRequired
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "board": {
        "minItems": 1,
        "maxItems": 24,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "square": {
              "type": "string",
              "pattern": "^(?:[aceg][1357]|[bdfh][2468])$",
              "description": "A playable square: a1 is bottom left; files a-h, ranks 1-8."
            },
            "player": {
              "type": "string",
              "enum": [
                "red",
                "black"
              ]
            },
            "king": {
              "description": "True for a king; omitted or false for a man.",
              "type": "boolean"
            }
          },
          "required": [
            "square",
            "player"
          ],
          "additionalProperties": false
        },
        "description": "All remaining pieces. Unlisted squares are empty; red moves toward rank 8, black toward rank 1."
      },
      "player": {
        "type": "string",
        "enum": [
          "red",
          "black"
        ],
        "description": "The side whose turn it is and whose move should be chosen."
      },
      "legalMoves": {
        "minItems": 1,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Your move ID, returned unchanged when selected. __proto__ is reserved."
            },
            "from": {
              "type": "string",
              "pattern": "^(?:[aceg][1357]|[bdfh][2468])$",
              "description": "A playable square: a1 is bottom left; files a-h, ranks 1-8."
            },
            "path": {
              "minItems": 1,
              "maxItems": 12,
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^(?:[aceg][1357]|[bdfh][2468])$",
                "description": "A playable square: a1 is bottom left; files a-h, ranks 1-8."
              },
              "description": "Every landing square in order, excluding from. Include the full jump sequence."
            },
            "captures": {
              "description": "Captured piece squares in jump order. Omit or use [] for an ordinary move.",
              "maxItems": 12,
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^(?:[aceg][1357]|[bdfh][2468])$",
                "description": "A playable square: a1 is bottom left; files a-h, ranks 1-8."
              }
            }
          },
          "required": [
            "id",
            "from",
            "path"
          ],
          "additionalProperties": false
        },
        "description": "One or more complete legal moves from your game, with unique IDs."
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "board",
      "player",
      "legalMoves"
    ],
    "additionalProperties": false
  },
  "result": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "model": {
        "type": "string"
      },
      "usage": {
        "type": "object",
        "properties": {
          "input_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "output_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "input_tokens",
          "output_tokens"
        ],
        "additionalProperties": false
      },
      "status": {
        "type": "string",
        "enum": [
          "ready",
          "review"
        ]
      },
      "verdict": {
        "type": "string",
        "enum": [
          "matched",
          "none",
          "ambiguous"
        ]
      },
      "selection": {
        "type": [
          "string",
          "null"
        ]
      },
      "suggestedSelection": {
        "type": [
          "string",
          "null"
        ]
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "probabilities": {
        "type": "object",
        "properties": {
          "candidates": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            }
          },
          "none": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "ambiguous": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "required": [
          "candidates",
          "none",
          "ambiguous"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "verdict",
      "selection",
      "suggestedSelection",
      "confidence",
      "probabilities"
    ],
    "additionalProperties": false
  }
}

Saved example result

This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo checkers-move.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "verdict": "matched",
  "selection": "capture-right",
  "suggestedSelection": "capture-right",
  "confidence": 0.94,
  "probabilities": {
    "candidates": {
      "capture-left": 0.02,
      "capture-right": 0.94
    },
    "none": 0.02,
    "ambiguous": 0.02
  }
}

Evaluation evidence

Unknown response origin

No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.

Use the evaluation guide to measure this decision on your own labeled cases.

Limitations

Related recipes