Script Organization
Current Structure
All R scripts have been organized into appropriate directories:
Production Code (R/)
Core Functions:
rectangular_puzzle.R- Rectangular puzzle generationhexagonal_puzzle.R- Hexagonal puzzle generationgradient_background.R- Background generationsvg_utils.R- SVG utilitiesimage_processing.R- PNG conversionmain_generator.R- Main orchestration
Clean Implementation:
puzzle_core_clean.R- Clean core with shared edgesjigsawR_clean.R- Clean API
Individual Pieces:
individual_pieces_final.R- Current individual pieces implementationbezier_utils.R- Bezier curve utilities
Archived Scripts (R/scripts_archive/)
Development and debugging scripts that were previously at top level:
debug_*.R- Debugging scriptstest_*.R- Test scriptsimplement_curve_reversal.Rrun_individual_pieces_generation.Rupdate_package_exports.R
Examples (inst/examples/)
clean_usage_example.R- Clean API usage exampleslegacy_compatibility.R- Backward compatibility (replacessvg_to_png_overlay.R)individual_pieces_example.R- Individual pieces demonstrationgenerate_puzzles.R- General puzzle generation examples
Tests (tests/)
test_clean_2x2.R- Clean implementation tests
Debug Scripts (debug_scripts/)
Historical debugging scripts for reference
Migration Notes
svg_to_png_overlay.R →
inst/examples/legacy_compatibility.R- Maintains backward compatibility
- New projects should use clean API
All debug and test scripts moved to
R/scripts_archive/- Preserved for reference
- Not part of production code
Usage
For new projects, use the clean API:
source("R/puzzle_core_clean.R")
source("R/jigsawR_clean.R")
puzzle <- generate_puzzle(
grid = c(2, 2),
seed = 1234,
output = "both"
)
For legacy compatibility:
source("inst/examples/legacy_compatibility.R")