• Sure there's recursion, a kind of knight, officer, is defined in terms of knight.
  • We need 5 uses of define-struct. One for regent, two for knight, and two for serf.
  • There are 5 constructors, one for each define-struct; 5 predicates, one for each define-struct; and 8 selectors: 2 for regent, 1+4 for knight, and 1+0 for serf.
  • We need 3 templates. One that takes a regent as input, one for a knight as input, and one for a serf as input.
  • We need 3 potato functions, one for each relevant data type. To write a function potatoes-of-regent, we need helper functions potatoes-of-knight and potatoes-of-serf.
  • We need lots of test cases for the potatoe functions:
    • A1: Assume we test each of the three functions separately. We need at least 2 different serfs, one of each kind. We need at least 2 knights, one of each kind. We need at least 1 regent, of the only kind.
    • A2: Assume we test only the main function potatoes-of-regent. We still need to test each of the cases of the helper functions. We could easily use four regents (= 2 * 2 * 1, or all combinations of the previous test cases).

      We could get away with fewer. Since an officer has two serfs, one regent with a general who is an officer could have two different kinds of serfs, thus testing multiple cases of potatoes-of-serfs at once.

      It is much easier to test each function separately, because it is easier to generate the test cases, and for larger examples, you need more test data to test all cases if you are only testing the main function.

    With either answer, be sure to pick each serf's number of potatoes well. E.g., it's not very helpful if each serf generates 0 potatoes: you can't tell if you're adding all the numbers up properly. E.g., if you pick the numbers 1, 10, 100, ..., you'd be able to check not only whether your sum is correct, but if it isn't, you should be able to tell which number wasn't being added correctly.

    In the real world, understanding all of the relevant test cases is very important for checking software products. This is part of the area of Quality Assurance, or QA.