REPOSITORY CODING · HARD
Isolate backtracking branches and saved solutions
Trying one word must not mutate another branch domain. Completed solutions must also retain their own assignment maps after the shared search cursor is cleared.
Constraint propagation and searchCrossword constraint laboratory
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
Ruby on Rails · 80 minute session
- Solve a bounded crossword fill from a rectangular grid of 1..7 rows/columns using # blocks, . blanks and uppercase ASCII fixed letters. The unique dictionary has 1..14 words, each 2..7 uppercase letters. Derive maximal across/down slots of length at least two and reject uncovered open cells or more than eight slots.
- Slot IDs are A-row-column or D-row-column with zero-based start coordinates. Match dictionary lengths, grid letters, fixed slot assignments and every crossing letter. Each dictionary word may be used at most once across all directions and disconnected components. Reject unknown fixed slots/words and incompatible fixed assignments.
- Use arc consistency, all-different singleton propagation, minimum-remaining-values/degree selection and isolated backtracking domains. Enumerate up to 100 full solutions with a 20000-node search budget, then sort by rendered grid and assignments. Reject explicit search/solution budget exhaustion rather than claiming uniqueness.
- Return sorted slot IDs, exact solutionCount, unique and up to limit (1..10, default two) solutions. Each solution owns independent grid strings and assignment maps. Empty solution sets are valid results. Native Rails also persists tenant-scoped rehearsal editions through ActiveRecord with explicit create/show/delete routes.