Christian Lawson-Perfect, Newcastle University

- Stage 3 coding theory module.
- Lecturer had 5 written homeworks, very procedural, sick of marking.

“CP, can you help?”

A *code* is a set of *codewords* that are each strings over a finite alphabet (\(\mathbb{Z}_p^n\) for our purposes).

A linear code is closed under addition.

Lots of linear algebra involved: matrices to generate codes, check codewords, etc.

**Example:**

\[ [4,2]\text{-repetition} = \{ \mathtt{0000}, \mathtt{0101}, \mathtt{1010}, \mathtt{1111} \} \]

- Receive homework sheets, solutions, and course notes from lecturer
- Identify commonly-used routines, bundle them in an extension
- Transcribe written questions into Numbas, without randomisation
- Add in randomisation
- Lecturer tests everything works
- Delivered to students!

Implementing the algorithms was fun.

But * YEESH* avoiding bugs was hard.

Having a "codeword" as a data type in Numbas made writing questions very easy.

All but one of the written questions could be marked automatically.

We improved some questions, and added some more formative questions on top.

A couple of bugs found by students - equal mix of my fault and faulty algorithm from the lecturer.

Adds `code`

and `codeword`

data types,

and functions to work with them.

Example:

```
A = repeat(
codeword(repeat(random(0..field_size-1),word_length-dimension),field_size),
dimension
)
basis = identity_left(A)
C = code(set_generated_by(parity_check_matrix(basis)))
min_distance = minimum_distance(C)
```

Also provides scripts to mark lists of codewords.

I also used an extension I'd written for a group theory course, which adds routines for dealing with groups of permutations (elements of \( S_n \)).

github.com/numbas/numbas-extension-permutations

It helped with things like randomising generating matrices.

`codewords`

extension available to everyone.

20 questions, free to reuse on **math**centre.