NAME

Langertha::Holmgang::Sim::Denken - The answer world denken — reasoning tasks, the answer handed in by tool, one checker per task like score_answer of Reasoning Gym

VERSION

version 0.001

SYNOPSIS

# suite.yaml
tools:
  - { name: antwort_abgeben, simulator: denken, description: …, parameters: { … antwort: string … } }

# a case: the state
state:
  aufgabe:
    type: denken
    art: countdown
    pruefung: { zahlen: [ 2, 3, 4 ], ziel: 20 }

my $sims = Langertha::Holmgang::Simulators->new;
my ( $output, $ok ) = $sims->tool_call( $state, denken => antwort_abgeben => { antwort => '(2+3)*4' } );

my ( $ok, $why ) = Langertha::Holmgang::Sim::Denken::pruefe( countdown => $pruefung, '(2+3)*4' );

DESCRIPTION

A world without a device (contract: Langertha::Holmgang::Role::AnswerWorld; type denken) for reasoning tasks: the task is in the message, the model hands in its answer with the only tool:

antwort_abgeben { antwort }    stores the answer; a repeated call replaces it

The output is always Antwort gespeichert. (answer stored) — the tool never tells whether the answer is right. The answer is graded when it is handed in and written into the state, which the model never sees:

aufgabe:
  type: denken
  art: <task>           # name of the task in Reasoning Gym, e.g. graph_color
  pruefung: { … }       # what the checker needs (solution or puzzle data)
  antwort: "…"          # the answer handed in last
  abgaben: 2            # number of calls
  ergebnis: richtig     # richtig | falsch (right | wrong) — the case's rule checks this
  befund: "…"           # the reason (for the report)

prepare checks, when the case loads, that art is known and that pruefung carries the fields its checker needs; otherwise the case does not load. A call the world refuses (no antwort, or not a text) changes nothing.

Checkers

Per task the same logic as score_answer of the task in Reasoning Gym (version 0.1.25); only the full score (1.0) counts as right, partial scores count as wrong. The fields of pruefung each checker needs are in brackets (antwort when none are named).

zebra_puzzles         equal without line breaks, ignoring case
knights_knaves        same set of pairs (name, role); order and wording do not matter
propositional_logic   follows from the premises (truth table) and is neither a tautology
                      nor a single atom (premissen, variablen)
syllogism, course_schedule, maze
                      exactly equal (the base of score_answer: equality = 1.0)
self_reference        exactly equal
shortest_path         equal (trimmed) or a valid path of the same length (antwort, matrix)
graph_color           JSON object node -> colour, every node coloured, allowed colours,
                      the ends of every edge differ (knoten, kanten, farben)
calendar_arithmetic   weekday trimmed equal, number equal as int, leap year ignoring case
                      (antwort, form)
time_intervals        the same duration in seconds, by the format of the task (antwort, form)
cryptarithm           "A=1,B=2": every letter, digits unique, no leading zero, the sum holds
                      (woerter, ergebnis; optional fuehrende_null)
mini_sudoku           equal up to white space at line ends, and not longer than the solution
family_relationships  trimmed equal, ignoring case
countdown             the expression yields the target and uses exactly the numbers
                      (as a multiset) (zahlen, ziel)
jugs                  JSON list of moves (fill X, empty X, pour X->Y); at the end a jug
                      holds the target (kruege, ziel)

Deviations from Python (for countdown, Python evaluates every Python expression with sympy): here only arithmetic counts — numbers, + - * / // % **, factorial n!, brackets; functions, constants, ^, comparisons and non-integer exponents are wrong. For jugs only a JSON list counts (Python would also walk the keys of an object). More than 16 atoms in a propositional answer are wrong.

Only the state, pure functions, deterministic, neutral.

device_type

denken.

tools

my $tools = $world->tools;   # { antwort_abgeben => ['antwort'] }

The tools of this world with their required parameters (for the loader).

prepare

$world->prepare( $aufgabe, $ctx );

Checks, when the case loads, that art is a known task and pruefung (a hash) carries the fields of its checker; dies otherwise. Changes nothing.

tool

my ( $output, $ok ) = $world->tool( $aufgabe, antwort_abgeben => { antwort => '…' } );

Stores the answer and its grade in $aufgabe (which is changed). A name not in "tools" is an error.

arten

my @arten = Langertha::Holmgang::Sim::Denken::arten();

The known tasks, sorted.

pruefe

my ( $richtig, $grund ) = Langertha::Holmgang::Sim::Denken::pruefe( $art, $pruefung, $antwort );

Grades an answer (text) like score_answer of the task: true only for the full score. $grund says briefly why.

SUPPORT

Issues

Please report bugs and feature requests at https://github.com/Getty/langertha-holmgang/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.