Walk the boundary arrow by arrow, then turn the code into the CFD and the shape number. Show me plays the whole answer one step at a time. Do it yourself makes you pick every direction, count every CFD step and find where the 0s start, and marks each one.
Everything in this chapter is three moves
STEP 1 · CHAIN CODE (CC)
Stand on the start pixel. Look at the next boundary pixel. Write the number of the arrow that points to it. Step there. Repeat until you are back at the start.
STEP 2 · CFD
From each digit to the next, count the anticlockwise steps on the compass. Same arrow = 0. The last digit goes to the first. This kills rotation.
STEP 3 · START AT THE 0
Underline the 0s. Start at the longest run of 0s (the end joins the start), read to the end, wrap round. Two runs the same length? Compare the digits after them. On the CC: start-point invariant. On the CFD: the NCFD = shape number.
Arrow numbers go round counterclockwise from 0 = right, like angles: k means k × 45°. Rows count downward, so a smaller row number is “up”.
Trainer
Mode
Things that cost marks
Draw the compass in every answer, and say which way you walk (clockwise or anticlockwise, as the question says).
The chain is a loop: the last move goes back to the start pixel, and the last CFD digit wraps round to the first code. CC and CFD have the same number of digits.
“Invariant to starting point” = smallest shift of the CC. “Invariant to starting point and rotation” = smallest shift of the CFD (NCFD).
A run of 0s can wrap: 0 0 3 0 1 2 0 0 has the run 0 0 0 0 (places 7 8 1 2), so the NCFD is 00003012, not 00301200.
Two runs read the same (506506)? The pattern repeats; either start gives 065065.
Slide 23 subtracts the other way round (this − next = counting clockwise). Slide 22, the textbook and the teacher count anticlockwise. Say which you use.
“Shape number” is used for both the smallest CC shift (slides 18, 24) and the NCFD (slides 21–22). Name each line you write.