LLetterRook
Product

Product features · Duplicate-aware letter feedback

01

Discuss duplicate accounting in LetterRook: an exact match consumes a letter before displaced matches are considered.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Duplicate-aware letter feedback

● ● ●LetterRook●
A concrete starting point · Duplicate-aware letter feedback ×
from collections import Counter

def letter_feedback(answer, guess):
    if any(type(s) is not str or len(s) != 5 or any(not "a" <= c <= "z" for c in s) for s in (answer, guess)):
        raise ValueError("word.lowercase")
    marks, remaining = [0] * 5, Counter()
    for i, (a, g) in enumerate(zip(answer, guess)):
        if a == g:
            marks[i] = 2
        else:
            remaining[a] += 1
    for i, g in enumerate(guess):
        if marks[i] != 2 and remaining[g]:
            marks[i] = 1
            remaining[g] -= 1
    return marks
✳Score a five-letter lowercase ASCII guess with 2 for exact, 1 for misplaced and 0 for absent letters.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗