Skip to content

Generate real families in the zweedse voorouders generator - #60

Merged
TomNaessens merged 2 commits into
masterfrom
bug/8846-zweedse-voorouders-generator
Oct 19, 2026
Merged

TomNaessens merged 2 commits into
masterfrom
bug/8846-zweedse-voorouders-generator

Conversation

@TomNaessens

@TomNaessens TomNaessens commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

tested/javascript/zweedse voorouders/preparation/generator.js produced broken family trees. All of these were confirmed by running it:

  • both name lists were read from male_names.txt;
  • the male list kept only names that are also female (!== -1 instead of === -1);
  • femalesList.left is undefined, so it always drew the first name instead of a random one;
  • splice returns an array, so names were one-element arrays and males.indexOf(child) never matched: every child recursed as a mother;
  • randint(0, 1) never returns 1 (the end is exclusive), so no son was ever drawn;
  • lines were written father mother ...children, while the description and the solution read mother father ...children.

A draw helper now takes one name (and throws when a list runs out instead of writing empty names).

The second commit regenerates the committed data with the fixed generator: all 50 workdir/data*.txt and evaluation/suite.yaml (Tom's call: a clean end result over a small diff). Every line is now mother father child... with the mother from female_names.txt and the father from male_names.txt. The description's own example data (description/media/data/data.txt) isn't generated and is unchanged; its examples still match the solution (fixed in #58).

Fixes the second box under "Defects found" in https://github.com/dodona-edu/dodona/issues/8846.

Manual testing instructions

  1. Copy tested/javascript/zweedse voorouders to a scratch directory, cd into its preparation/ and run node generator.js.
  2. Open a few of the committed (and regenerated) workdir/data*.txt: the first name on each line is in female_names.txt, the second in male_names.txt, and no line has an empty name.
  3. Edge case: cut both name files to three names and rerun: it stops with Error: ran out of names instead of writing empty names.
Verification (scratch copies, node 22)
Generator Mothers from the female list Fathers from the male list Children male / female Children whose sex doesn't match their parent role
master 16/323 323/323 669 / 0 1
this branch 362/362 362/362 361 / 397 0

The fixed generator ran 40/40 times on the real name lists without running out. Committed regenerated data (319 lines in 50 files): 0 lines with a mother outside the female list, a father outside the male list, or an empty name. dodona-authoring verify on it (ghcr.io/dodona-edu/dodona-tested, universal-judge efd4de5): DSL valid, reference solution 350/350 correct, // wrong rejected (0 correct). Also run the way Dodona does, with natural_language en and nl: 350/350 correct each.

Not changed: randint is end-exclusive everywhere, so families get 1..maxChildren-1 children and descendants generations are only 1 or 2.

🤖 Generated with Claude Code

It read male_names.txt for both lists, kept only names in both lists, drew from
an undefined length, stored one-element arrays as names, never drew a son
(randint excludes its end) and wrote the father before the mother.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomNaessens TomNaessens added the bug Something isn't working label Oct 19, 2026
@TomNaessens TomNaessens self-assigned this Oct 19, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomNaessens
TomNaessens marked this pull request as ready for review October 19, 2026 16:19
@TomNaessens
TomNaessens enabled auto-merge October 19, 2026 16:19
@TomNaessens
TomNaessens merged commit 6ecc48f into master Oct 19, 2026
@TomNaessens
TomNaessens deleted the bug/8846-zweedse-voorouders-generator branch October 19, 2026 16:46
@pdawyndt

Copy link
Copy Markdown

@TomNaessens With this test suite, no links to the files are added in the feedback. As such, students cannot access the content of the files used in the test cases.

@TomNaessens

Copy link
Copy Markdown
Contributor Author

@TomNaessens With this test suite, no links to the files are added in the feedback. As such, students cannot access the content of the files used in the test cases.

Ah, indeed! #65 declares them now, and fixes the same gap in data-visualization.

Screenshot from a local run:

Feedback of the first context: data1.txt in let relations1 = familyMembers("data1.txt") is a link

Clicking data1.txt opens it in a file viewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants