Skip to main content

Code Katas and Fault Experiments

Use the four guided labs; their hours are already included in the module budget. First-time implementation and proof review have no 20-minute completion requirement.

For each API family, predict one ordinary, one empty and one invalid input. Then introduce a deliberate fault in a copy of your implementation and preserve the smallest failing case before restoring correct code:

  • Count ordered coin sequences when unordered multisets were requested.
  • Use n−1 edges alone to recognize a tree.
  • Ignore isolated vertices when counting components.
  • Use even degrees alone for Euler existence in two disconnected triangles.
  • Count simple paths when the API requests walks.
  • Divide proper colorings by k! without proving uniform color-label fibers.
  • Return a maximal greedy matching without proving maximum size.

Explain which definition the failure violates. Passing a test after copying a reference implementation is setup evidence; your own proof and fresh transfer attempt establish learning evidence. Reuse the P1–P20 identifiers in your notebook.