jevrecipes

Recipe catalog / checkers-move

Choose a checkers move

checkers-move is a Jev recipe from the jev-recipes TypeScript package. Recommend a supplied legal checkers move from a structured board and player, with built-in American/English checkers instructions. Use it when your checkers game already provides its board, acting player, and legal moves, and you want a move ID without writing decision prompts.

Last updated .

Explore this recipe interactively · Source and implementation guide · Markdown version

How do I 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);

What input does checkers-move take?

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
  }
}

What does a checkers-move result look like?

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
  }
}

Input

Only three fields are required: board, player, and legalMoves. Your game supplies the current position and legal moves; the recipe supplies the checkers decision instructions. No image, free-text rules, action descriptions, or separate turn request is needed.

Board and player

board lists every remaining piece as { square, player, king? }. Unlisted squares are empty. Use player: 'red' or 'black' for piece ownership and for the side whose move you want. king defaults to false when omitted. Map your game's colors to these two labels once.

Coordinates are fixed, regardless of whose turn it is or how your interface rotates the board:

         a  b  c  d  e  f  g  h
rank 8   . b8  . d8  . f8  . h8   red promotes here
rank 7  a7  . c7  . e7  . g7  .
rank 6   . b6  . d6  . f6  . h6   black starts on ranks 6-8
rank 5  a5  . c5  . e5  . g5  .
rank 4   . b4  . d4  . f4  . h4
rank 3  a3  . c3  . e3  . g3  .   red starts on ranks 1-3
rank 2   . b2  . d2  . f2  . h2
rank 1  a1  . c1  . e1  . g1  .   black promotes here

The dots are unplayable light squares. Red men move toward rank 8; black men move toward rank 1. Kings can move and capture in either direction. This coordinate and color mapping is the recipe's API convention, not official numbered checkers notation.

Legal moves

Each move is { id, from, path, captures? }:

For example, { id: 'jump', from: 'c3', path: ['e5', 'g7'], captures: ['d4', 'f6'] } means jump over d4 to e5, then over f6 to g7. A king's path may return to a previously visited square, including its starting square; the captured squares must be unique.

Supply one or more legal moves from the same board snapshot. Handle no-move and finished-game states in your game before calling. When there is only one legal move, your game can use it directly and avoid a model request. A valid recipe call always makes one logical request, even with one candidate. The recipe imposes no move-count cap and sends the entire list; provider request limits still apply. It adds none and ambiguous as two additional choices.

The schema checks playable coordinates, unique occupied squares, at most twelve pieces per player, unique IDs, path/capture lengths, starting-piece ownership, and captured-piece references. It rejects unknown fields to catch adapter mistakes. These are input consistency checks, not a legality proof: your game must enforce geometry, empty landing squares, compulsory captures, complete jump chains, promotion, turns, and game completion.

minConfidence is optional and defaults to 0.8. See shared options for client injection, model selection, abort signals, and errors.

Use the selected move

After the usage example:

if (result.status === 'ready' && result.selection !== null) {
  console.log('Recommended move ID:', result.selection);
} else {
  console.log('Needs another decision:', result.status, result.verdict);
}

Use the ID to find the original move in your game's list, for example legalMoves.find((move) => move.id === result.selection). The checkers example shows a working integration. Before applying that move, check that the game is still on the same turn and board snapshot, and that the move is still legal. Discard stale results. The recipe never changes the board or executes a move. Handle validation and provider errors in your application's error path.

Result

The result uses the same shape as choose-action:

Field Meaning
selection Your move ID when matched at sufficient confidence; otherwise null.
suggestedSelection Preserves a proposed move below the confidence threshold for inspection.
verdict matched, none, or ambiguous.
status ready or review; ambiguous decisions always require review.
confidence Model confidence in this decision, not a measured probability of winning.
probabilities Candidate probabilities under your original IDs, plus none and ambiguous.
model, usage Provider model and token usage, preserved from the response.

A ready none still has no move. With valid supplied legal moves, the intended behavior is a recommendation or review; none is reserved for a supplied position in which no candidate can be used. Do not execute suggestedSelection merely because it is present.

Decision policy

The objective is to win under 8x8 American/English checkers rules. The recipe supplies the orientation, movement, capture, and promotion conventions. Captures are compulsory, but choosing the sequence with the most captures is not compulsory. A man reaching the promotion row ends its turn. These rules follow the WCDF rules of checkers, section 1; the API uses its own documented color and coordinate mapping.

The instructions ask Jev to compare immediate wins, material, kings, exposure to replies, promotion, and mobility. They do not instruct it to choose the largest capture blindly. An unresolved tie requires review. Ordinary uncertainty about future play alone does not require review.

The board is translated into labeled pieces, such as c3: your man, and each move becomes a description. Piece counts and promotion labels are prepared in code. This follows TypeSafe's guidance to perform counting in code and give Jev semantic descriptions. It is a design choice, not evidence of playing strength.

Reuse and limits

How accurate is checkers-move?

Current measurement; labels unspecified

jev-1.13.0 / 2026-10-04 / 31 development cases

Scoring revision 2.

55%All-case accuracy
31Sent for review
0Failed calls / cases

0 ready decisions, with n/a accuracy among those decisions.

95% case-level interval: 38% to 71%. Related synthetic cases are correlated.

This measures the recorded dataset, not general readiness. Label sources: unspecified: Not recorded by the dataset author.

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

What are the limits of checkers-move?