C++ / C# · progressively harder
Optional challenge bank
Explore the repository freely, or choose a challenge for inspiration; completing all 18 levels is not expected.
Use these optional challenges when you want a starting point or a next investigation. They are useful after the four core exercises, but can be explored in any order; each level names its prerequisites, and you do not need to complete the whole bank. Use your assigned language unless it says both.
The file map and test commands is a reference, not required reading before every exercise. Prompt support fades from questions to keywords and then your own approach; use whatever support fits the level you choose. Ask OpenCode for a small hint when needed.
Read the selected level in docs/challenges.md. Tell us its purpose, the first check to run, and which result we should inspect before editing.
Optional · 18 levels
Pick your next level together
Levels 1–7 use your assigned language. Levels 8–18 may use both C++ and C#.
-
01Map both implementationsFind the corresponding functions and tests in C++ and C# before extending them.Purpose · task · result
PurposeFind the corresponding functions and tests in C++ and C# before extending them.
Task- Run
git status --shortandgit rev-parse HEADas a separate extra-exercise baseline; describe existing changes only if they affect your comparison. - Use the file map to locate both implementations of
ClippedAreaandClassifyPoint, and their actual test assertions. - Run
./scripts/test-cpp.shand./scripts/test-csharp.sh; keep both results available for comparison without editing.
HintThe core exercises may already have changed one language. Preserve that starting point.
Prompt supportAsk for a file map and both test results.
Done whenYou can locate both versions and distinguish existing failures from later changes.
- Run
-
02Map specification rules to testsFind behaviours the public tests cover—and those they miss.Purpose · task · result
PurposeFind behaviours the public tests cover—and those they miss.
Task- Read docs/spec.md and both public-test files from the file map.
- Create
docs/contract-test-matrix.md: one row per explicit rule, with C++ assertion, C# assertion and coverage gap columns. - Check each assertion’s input and comparison; cite its file and test name or line. Do not edit tests yet.
HintAn untested rule is a coverage gap. Behaviour the specification never defines is a different kind of gap.
Prompt supportAsk which assertions support each rule and what is missing.
Done whenEvery explicit rule has traceable coverage or a clearly named gap.
-
03Add small geometry regressionsProtect two defined behaviours with examples you can calculate yourself.Purpose · task · result
PurposeProtect two defined behaviours with examples you can calculate yourself.
TaskIn your assigned language’s public tests, add missing coverage for:
- Vertex classification: polygon
(0,0),(10,0),(10,10),(0,10), point(0,0)→Boundary. - Partial overlap: polygon
(5,5),(15,5),(15,15),(5,15),Rect64(0,0,10,10)→ area25.
Test both vertex orders. Explain each expectation, avoid duplicate coverage, and run
./scripts/test-cpp.shor./scripts/test-csharp.sh.HintCompare classification exactly and area within
0.001; a reversed polygon describes the same shape.Prompt supportAsk for justified expectations and regressions in both orientations.
Done whenBoth cases and orientations pass in your language’s public suite.
- Vertex classification: polygon
-
04Test touching shapes and translationCheck that touching produces zero area and moving all inputs preserves behaviour.Purpose · task · result
PurposeCheck that touching produces zero area and moving all inputs preserves behaviour.
TaskAdd these cases to your assigned public tests:
- Edge touch: polygon
(10,2),(14,2),(14,8),(10,8)andRect64(0,0,10,10)→ exactly0. - Corner touch: polygon
(10,10),(14,10),(14,14),(10,14)with that rectangle → exactly0. - Translation: polygon
(2,2),(8,2),(8,8),(2,8),Rect64(0,0,6,6), point(2,5). Calculate area and classification first. Then shift polygon, rectangle and point by(-5,-7)and assert both the calculated expectations and unchanged results.
Run
./scripts/test-cpp.shor./scripts/test-csharp.sh.HintUse exact zero and classification assertions; use
0.001tolerance for nonzero areas and area comparisons.Prompt starter — finish it as a teamAsk why touching and translation should preserve these expectations.
Done whenOriginal and translated cases pass with independently explained expectations.
- Edge touch: polygon
-
05Predict before runningSeparate your prediction, the AI’s confidence and the implementation’s actual behaviour.Purpose · task · result
PurposeSeparate your prediction, the AI’s confidence and the implementation’s actual behaviour.
TaskFirst write your team’s predictions, then ask for AI predictions and confidence. Do not run these inputs until both are saved in
docs/prediction-results.md.Operation Polygon Rectangle or point ClassifyPoint (0,10),(10,10),(10,0),(0,0)point (10,10)ClassifyPoint (0,0),(0,0),(10,0),(10,10),(0,10)point (5,0)ClippedArea (0,0),(10,0),(10,10),(0,10)Rect64(5,0,5,10)ClippedArea (0,0),(10,10)Rect64(0,0,10,10)ClippedArea (0,0),(1000000,0),(1000000,1),(0,1)Rect64(0,0,1000000,1000000)ClassifyPoint (0,0),(10,10),(10,0),(0,10)point (5,5)Use a temporary runner in your language under
build/experiments/to print actual results. Save the exact command and observations beside the original predictions, identify which results the specification promises, then remove the runner.HintSome inputs are deliberately outside the specification’s defined cases. Print observations; do not turn guesses into test assertions.
Prompt starter — finish it as a teamAsk for predictions and confidence before allowing any execution.
Done whenAll six rows distinguish predictions, observations and specification coverage; wrapper and public tests are unchanged.
-
06Propose a missing ruleTurn unspecified behaviour into an explicit design question.Purpose · task · result
PurposeTurn unspecified behaviour into an explicit design question.
Task- In your language, use a temporary runner to observe
ClippedAreafor(0,0),(10,10),(10,0),(0,10)andRect64(0,0,10,10). - This polygon crosses itself; docs/spec.md does not settle its interpretation. Propose a testable rule with a benefit, compatibility implications and an example test.
- Append the proposal, input, exact command and observation to
docs/spec-proposals.md(create it if absent). Remove the runner; leave the existing specification, wrapper and tests unchanged.
HintObserved output is evidence for discussion, not automatically the required answer.
Prompt starter — finish it as a teamAsk what rule would make this behaviour testable.
Done whenA clearly labelled proposal explains both the intended behaviour and its consequences.
- In your language, use a temporary runner to observe
-
07Challenge a proposed optimisationUse a counterexample to test whether a faster-looking implementation is correct.Purpose · task · result
PurposeUse a counterexample to test whether a faster-looking implementation is correct.
TaskStart with passing tests in your assigned language.
- Read the supplied bounding-box proposal. Design a polygon where one of its early returns gives the wrong area. Calculate the correct result independently.
- Add a public regression and show it passing on the original code.
- Apply
./scripts/apply-l7-patch.sh cppor./scripts/apply-l7-patch.sh csharp. Run your language’s test script and show an assertion failure. Then run the same helper with--revertand demonstrate a pass again.
Record the calculation and three results. If the helper cannot find its insertion point, stop and ask a facilitator; do not adapt or force the patch.
HintA polygon’s bounding box can contain empty space. Inspect the final diff: keep the regression and other team work, remove every temporary patch line.
Optional hintAsk which early-return claim a counterexample could disprove.
Done whenThe recorded pass → assertion failure → pass shows that your regression rejects the proposal.
-
08Mirror a regression in both languagesCheck that C++ and C# protect the same behaviour.Purpose · task · result
PurposeCheck that C++ and C# protect the same behaviour.
Task- Choose a regression from extras 3–7, or the partial-overlap case in extra 3 if you skipped them.
- Add equivalent assertions to both public-test files in the file map. Compare coordinates, ordering, expected values and tolerances side by side.
- Run
./scripts/test-cpp.sh,./scripts/test-csharp.shand./scripts/test-all.sh.
HintInvestigate mismatches; do not change expectations just to match each implementation.
Optional hintPrompt ingredients: same input, same expectation, both languages.
Done whenBoth suites test the same justified result and all three commands pass.
-
09Follow a clipping operation through the libraryVerify an AI explanation against actual Clipper2 source.Purpose · task · result
PurposeVerify an AI explanation against actual Clipper2 source.
Task- Ask how an edge crossing is handled and output paths are assembled. In your language, locate
GetIntersection,AddCornerandExecuteInternalinsrc/cpp/Clipper2Lib/src/clipper.rectclip.cpporsrc/csharp/Clipper2Lib/Clipper.RectClip.cs. - Open and verify at least two
file:linecitations from the explanation. - Test one observable claim through
ClippedAreaorRectClipin your public suite. Explain the expected result, run your language’s test script and retain the passing regression.
HintTrace one small example. Save the exact prompt and context if you want to compare models in extra 17.
Optional hintPrompt ingredients: edge crossing, source citations, observable evidence.
Done whenTwo citations support the explanation and a passing test demonstrates one claim.
- Ask how an edge crossing is handled and output paths are assembled. In your language, locate
-
10Test relationships across shapesCheck properties across multiple inputs while keeping exact-value regressions.Purpose · task · result
PurposeCheck properties across multiple inputs while keeping exact-value regressions.
Task- Define the same fixed list of at most 20 small rectangles or non-self-intersecting triangles in both public suites. Give each explicit coordinates, clip rectangle, query point and stable case ID.
- Test that reversing vertex order or translating all inputs together preserves area and classification. Check clipped area lies between zero and the rectangle’s area. Explain why these relationships hold.
- Keep earlier exact-value assertions, identify cases and coordinates in failures, and run both language scripts plus
./scripts/test-all.sh.
HintUse
0.001area tolerance consistently, including bounds. Relationships alone can miss an implementation that always returns zero.Optional hintPrompt ingredients: fixed cases, invariants, exact-value tests.
Done whenBoth languages pass the same reproducible cases and retain independent expected-value tests.
-
11Compare language outputs automaticallyBuild differential testing: give both implementations identical inputs and report output differences.Purpose · task · result
PurposeBuild differential testing: give both implementations identical inputs and report output differences.
Task- Choose at least 20 fixed valid cases with IDs, polygons, clip rectangles and query points. Reuse extra 10’s cases and add enough to reach 20.
- Make the public-test executables write fresh
build/parity-cpp.csvandbuild/parity-csharp.csv: columnscase_id,area,classification, identical ordering, invariant decimal formatting and namesOutside,Boundary,Inside. - Create executable
scripts/parity-diff.sh. Compare by ID; reject duplicates, missing IDs, different classifications or area differences above0.001, returning nonzero on failure. - Run the exact generation/comparison commands. Demonstrate a detected mismatch with an altered copy, then regenerate genuine outputs. Keep CSVs out of commits.
HintResolve paths from the repository root and show absolute output paths. Prevent stale CSVs surviving failed generation. Language agreement does not replace independently justified tests.
Optional hintPrompt ingredients: fresh outputs, reliable comparison, demonstrated failure.
Done whenGenuine outputs match or have explained differences, the comparator detects a deliberate mismatch, and normal tests still run.
-
12Add a small batch APIAgree on a feature’s behaviour before asking AI to implement it.Purpose · task · result
PurposeAgree on a feature’s behaviour before asking AI to implement it.
Task- Choose
ClassifyPoints(many points, one polygon) orClippedAreas(many polygons, one rectangle; the default). Write exact C++/C# signatures indocs/batch-api.md: preserve input order, return an empty list for empty input, and match separate single-input calls. Areas remain independent, not a polygon union. - Ask for separate API-convention and test-design passes, using bounded assistants if available or sequentially otherwise. Review the integrated plan as a team before implementation.
- Add the API and declarations in both languages, with empty-input and order-sensitive mixed-input tests. Run both language scripts and
./scripts/test-all.sh.
HintKeep the feature a thin layer over the existing functions; verify every assistant’s contribution.
Optional hintPrompt ingredients: contract first, bounded work, verification.
Done whenBoth APIs follow the agreed document and tests pass, including empty input and ordering.
- Choose
-
13Prove a regression catches a bugPractise mutation testing: temporarily introduce a specific mistake and show your test detects it.Purpose · task · result
PurposePractise mutation testing: temporarily introduce a specific mistake and show your test detects it.
TaskStart from passing tests in your assigned language.
- Design a non-self-intersecting polygon whose clipped intersection has at least two separate pieces. In a temporary runner, confirm raw
RectClippath count with.size()(C++) or.Count(C#). Independently calculate their combined area and add aClippedArearegression. - Show the regression passing. Save the exact current accumulation/return lines, then temporarily replace them with the incorrect return below. Run your language’s test script and demonstrate an assertion failure.
- Restore those exact lines and show a pass. Retain the regression and results; remove the runner and all deliberately incorrect code without losing other changes.
C++ temporary return:
return clipped.empty() ? 0.0 : std::abs(Clipper2Lib::Area(clipped.front()));C# temporary return:
return clipped.Count == 0 ? 0.0 : Math.Abs(Clipper.Area(clipped[0]));HintThe bug counts only the first piece. If your result variable is not
clippedor the replacement boundary is unclear, ask a facilitator. A compilation failure is not proof.Optional hintYour turn: design the request.
Done whenYou recorded at least two paths and pass → intended assertion failure → pass; the original implementation is restored.
- Design a non-self-intersecting polygon whose clipped intersection has at least two separate pieces. In a temporary runner, confirm raw
-
14Reduce an input without losing its behaviourMake a surprising result easier to investigate by finding a smaller example.Purpose · task · result
PurposeMake a surprising result easier to investigate by finding a smaller example.
TaskUse your language’s
ClippedAreawithRect64(0,0,20,20)and:(0,0),(5,5),(10,10),(15,15),(20,20),(20,10), (20,0),(15,5),(10,10),(5,15),(0,20),(0,10)- Create a temporary runner under
build/experiments/that reads vertices from a data file. Record its exact command and initial result indocs/minimised-case.md. - Choose a fixed condition to preserve, such as that area within a stated tolerance. Remove one vertex at a time, keeping order and at least three vertices; rerun after each attempt. Record accepted and rejected removals.
- At the end, try every permitted single-vertex removal. Retain the final input, condition, commands and results; remove the runner. Leave wrapper and public tests unchanged.
HintThe polygon crosses itself, so its result is an observation, not a specification guarantee. No further single deletion means locally minimal, not globally smallest.
Optional hintYour turn: design the request.
Done whenThe smaller input preserves your fixed condition and the final deletion attempts justify local minimality.
- Create a temporary runner under
-
15Investigate precision at large coordinatesSee whether an exact integer area survives the API’s floating-point return value.Purpose · task · result
PurposeSee whether an exact integer area survives the API’s floating-point return value.
Task- For
k = 1..9, setn = 10^k - 1. Use square(0,0),(n,0),(n,n),(0,n)andRect64(0,0,n,n); its exact area isn × n. - In a temporary runner under
build/, use your language’sBigInteger,unsigned __int128or a verified equivalent. Print nine ordered rows:k,n, exact integer area, actualClippedArearesult and exact numeric equality. Do not round the expected integer to double before comparing. - Save all rows, exact command and first mismatch (if any) in
docs/precision-results.md. Append an accuracy/range proposal with compatibility implications todocs/spec-proposals.md, creating it if needed. Remove the runner; leave existing specification, wrapper and tests unchanged.
HintExplain the comparison method before trusting it. This investigates exact equality, not the ordinary
0.001test tolerance.Optional hintYour turn: design the request.
Done whenYour evidence preserves the exact reference and supports a clearly labelled proposal, without assuming a mismatch must occur.
- For
-
16Prepare a reviewable changeMake it easy for someone else to understand and assess your work.Purpose · task · result
PurposeMake it easy for someone else to understand and assess your work.
Task- Use the extra-exercise baseline from extra 1, or identify a commit immediately before your intended changes. Confirm the diff contains the right scope.
- Inspect
git status --shortandgit diff. Put remaining work into focused commits without generated files, unrelated changes or rewriting shared history. Run./scripts/test-all.sh. - In a fresh AI conversation, request a review with the exact baseline/final commits, relevant specification, source and test output. Look for unsupported claims, unrelated changes, weakened assertions and missing negative cases.
- Assess substantive findings in
docs/review-notes.md: accept or reject with evidence. Fix grounded issues, rerun affected tests and update the final revision.
HintNegative cases exercise different or empty results, or documented rejection. Treat review findings as hypotheses; do not request a quota of problems.
Optional hintYour turn: design the request.
Done whenThe scope and commit purposes are clear, findings are resolved with reasons, and final tests pass.
-
17Compare two models fairlyChoose which answer to trust using evidence rather than confidence or length.Purpose · task · result
PurposeChoose which answer to trust using evidence rather than confidence or length.
Task- Reuse a question from extra 7 or 9. Prepare one prompt and the same code/specification snapshot for both models; include neither model’s earlier answer.
- For each run, use
/new,/models, then Tab to select Plan (details). Record actual model names. Decline file-changing actions, compare before/after diffs, and time each complete answer with a phone timer. - In
docs/model-comparison.md, make two model rows with three columns: citations verified, one claim tested with actual command/result, and elapsed time. Verify claims after collecting both answers; label missing evidence honestly. - Explain which answer you trust and why. Retain experiment inputs/results, then remove only temporary comparison code; preserve earlier tests.
HintFresh conversations and identical context make the comparison meaningful. Plan alone does not guarantee files stay unchanged.
Optional hintYour turn: design the request.
Done whenTwo equivalent runs have an evidence-based comparison and no source/test changes from the experiment remain.
-
18Write useful instructions for your AITurn your experience into working rules you can test.Purpose · task · result
PurposeTurn your experience into working rules you can test.
Task- Choose lessons from successful approaches, confusion or an optional AI mistake. Write 3–5 concise rules in
docs/team-rules.md, each with an observable action and the experience behind it. - Choose an earlier prompt that could benefit. In a fresh conversation, explicitly load the rules, supply the same necessary context and repeat that prompt unchanged.
- Record a brief before/after comparison: what did you expect to change, and what actually changed?
HintThe file is not loaded automatically. Keep existing repository agent instructions intact; “no clear improvement” is a valid observation.
Optional hintYour turn: design the request.
Done whenYour rules are specific, explicitly used in a fresh conversation, and evaluated against an earlier response.
- Choose lessons from successful approaches, confusion or an optional AI mistake. Write 3–5 concise rules in