LLetterRook
Workflows

Coding workflows · Duplicate-aware letter feedback

03
Built around your work

A concrete starting point

Score a five-letter lowercase ASCII guess with 2 for exact, 1 for misplaced and 0 for absent letters. Test repeated letters after reserving exact matches, rejecting uppercase, non-ASCII or wrong-length words.

01

Open the context

Choose the project folder and name the files or behavior involved.

02

Define the change

Describe the input, expected output and boundaries that must stay intact.

03

Inspect the work

Review the proposed edits and any commands before relying on their result.

04

Check the outcome

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Duplicate-aware letter feedback

A concrete starting point
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

The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.

AI coding workspace

Your next change starts here.

Get the Windows app ↗