Skip to content

CodeTailor: regroup Java puzzles into larger, labeled blocks - #1619

Merged
bnmnetp merged 2 commits into
RunestoneInteractive:mainfrom
aspadiyath:codetailor-java-puzzle-blocks
Oct 20, 2026
Merged

bnmnetp merged 2 commits into
RunestoneInteractive:mainfrom
aspadiyath:codetailor-java-puzzle-blocks

Conversation

@aspadiyath

Copy link
Copy Markdown
Contributor

CodeTailor's Java puzzles put most lines in their own block. That leaves a puzzle full of identical { and } blocks, plus statements whose order doesn't matter, and the line grader accepts only one order. For example, three constructor assignments in a different order are marked wrong, and the feedback then also highlighted several brace blocks.

This regroups a finished Java puzzle (new java_puzzle_blocks.py, called at the end of get_parsons_help):

  • an opening brace joins the header it opens (public int getPrice() + {)
  • each closing brace is its own block, labeled with what it closes: } // end getPrice, } // end if, } // end constructor, } // end class
  • consecutive statements at the same indentation share a block; a header always starts a new block
  • a paired distractor becomes a copy of the regrouped block with its lines swapped in, and still follows that block

Puzzles with #settled blocks are returned unchanged, so "Multiple"-level puzzles are not affected. Python puzzles are not affected.

On five new CSAwesome Unit 3 problems, puzzles went from 16–27 blocks to 10–16, with no bare {/} blocks left, and they check out in the browser. Tests: test/bases/rsptx/book_server_api/test_java_puzzle_blocks.py.

🤖 Generated with Claude Code

CodeTailor's Java puzzles put most lines in their own block, so a puzzle
is full of identical { and } blocks and of statements whose order does
not matter, while the line grader accepts only one order (e.g. three
constructor assignments in a different order were marked wrong). Regroup
finished Java puzzles so an opening brace joins its header, each closing
brace is labeled with what it closes (} // end getPrice), and
consecutive same-indentation statements share a block. Paired
distractors become a copy of the regrouped block with their lines
swapped in. Puzzles with settled blocks are left as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aspadiyath
aspadiyath requested a review from bnmnetp as a code owner October 19, 2026 17:48
…lock

CodeTailor sometimes pairs a block like "}" / header / "{" with a
distractor that differs only in the header. Keeping that block whole
left the previous method's closing brace stuck to the next header,
unlabeled. Lines shared by the block and all its distractors at either
end now regroup like any other line; only the differing lines are
swapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bnmnetp
bnmnetp merged commit be281fd into RunestoneInteractive:main Oct 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants