A poker-style hand evaluator whose card parser mishandles tens. Fix it, then rank five-card hands, pick the best five from up to seven, and make the ranking configurable.
A small TypeScript library with a bug. Part 1: make the failing tests pass without touching tests/. Parts 2 to 4 unlock in order as each part's public tests pass. In a mock interview the product owner asks for a plan before each part, and the grader reads your answer.
1Fix card parsing so tens are read correctly
2Compare full hands
3Partial hands
4Extensible ranking
Part 1: Fix card parsing so tens are read correctly
01Any hand that contains a ten (10H, 10S, ...) is rejected with a RangeError.
02Every other card parses fine, and the rank table itself checks out.
03Hands are five space-separated cards such as "10H JH QH KH AH".
What the hidden tests check in Part 1
A bare rank with no suit ("10", "A") and a lowercase suit ("10h") still throw RangeError.
A hand of six cards, or of four, throws RangeError.
Two different tens in one hand parse; the same card twice throws RangeError.
Hints for Parts 2 to 4 appear in the workspace as each part unlocks.