Skip to content

feat: normalize tabsize formula and default across all puzzle types - #94

Merged
pjt222 merged 2 commits into
mainfrom
feat/normalize-tabsize
Feb 11, 2026
Merged

feat: normalize tabsize formula and default across all puzzle types#94
pjt222 merged 2 commits into
mainfrom
feat/normalize-tabsize

Conversation

@pjt222

@pjt222 pjt222 commented Feb 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Normalize tabsize formula: Rectangular and legacy hexagonal puzzles used tabsize / 200 while all other types (concentric, voronoi, random, snic) used tabsize / 100. Now all types use / 100.
  • New default tabsize = 6: Produces ~18% tab-to-edge ratio across all puzzle types — consistent, proportional, and no overlap on short irregular edges.
  • Update documentation: Roxygen @param descriptions, quarto gallery parameter tables, and API reference pages all reflect the new default and semantics.

Visual impact

Type Before (default 10) After (default 6)
Rectangular 15% of edge (10/200) 18% of edge (6/100)
Hexagonal 30% of edge (10/100) 18% of edge (6/100)
Concentric 30% of edge (10/100) 18% of edge (6/100)
Voronoi 30% of edge (10/100) 18% of edge (6/100)
Random 30% of edge (10/100) 18% of edge (6/100)
SNIC 30% of edge (10/100) 18% of edge (6/100)

Files changed

  • 21 R source files (formula + defaults)
  • inst/config.yml (source of truth)
  • 11 quarto documentation pages

Test plan

  • devtools::test() — 2064 pass, 3 pre-existing failures (unrelated: theme_puzzle transparent default, snic platform-specific)
  • Visual check: generate one puzzle per type at default tabsize=6
  • Shiny app: confirm default slider shows 6

🤖 Generated with Claude Code

Standardize tabsize conversion to /100 everywhere (rectangular and legacy
hex used /200) and set new default to 6. This ensures consistent tab
proportions across all puzzle types — the same tabsize value now produces
the same tab-to-edge ratio regardless of puzzle type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes how tabsize is interpreted across all puzzle generators by normalizing the underlying formula and aligning defaults/documentation so tab proportions are consistent across puzzle types.

Changes:

  • Normalize tabsize scaling to use / 100 consistently (including rectangular + legacy hex paths).
  • Change the default tabsize to 6 across generators, config, and ggplot geoms/stats.
  • Update Quarto + roxygen docs to reflect new defaults/semantics and reorganize some gallery examples.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
quarto/index.qmd Update landing page copy and example annotations for new defaults / puzzle count.
quarto/getting-started.qmd Update getting-started parameter equivalence table for new default tabsize.
quarto/gallery/voronoi.qmd Update Voronoi gallery default tabsize and reorder example tabs.
quarto/gallery/snic.qmd Update SNIC gallery default tabsize.
quarto/gallery/rectangular.qmd Update rectangular gallery default tabsize and reorder example tabs.
quarto/gallery/random.qmd Update random gallery default tabsize.
quarto/gallery/hexagonal.qmd Update hex gallery default tabsize.
quarto/gallery/concentric.qmd Update concentric gallery default tabsize and reorder example tabs.
quarto/api/ggpuzzle.qmd Update ggpuzzle API tables to show new tabsize default.
quarto/api/generate-puzzle.qmd Update generate_puzzle API docs for new tabsize default + semantics.
inst/config.yml Update configuration “source of truth” default tabsize to 6 (incl. development).
R/unified_piece_generation.R Update internal unified generator default tabsize.
R/tessellation_edge_generation.R Update tessellation edge generator defaults used by Voronoi/random/SNIC.
R/svg_utils.R Update enhanced SVG helper default tabsize.
R/stat_puzzle.R Update ggplot2 stat default tabsize.
R/snic_puzzle.R Update SNIC internal generator default tabsize.
R/rectangular_puzzle.R Normalize rectangular tabsize formula (/100) and update defaults.
R/puzzle_core_clean.R Update core generator default tabsize.
R/main_generator.R Update orchestration helper default tabsize.
R/jigsawR_clean.R Update main generate_puzzle() default tabsize.
R/individual_pieces_final.R Update individual piece utilities default tabsize.
R/individual_pieces.R Update individual piece utilities default tabsize.
R/hexagonal_separation.R Update hex separation helpers default tabsize.
R/hexagonal_puzzle.R Normalize hex tabsize formula (/100) and update defaults/examples.
R/hexagonal_piece_extraction.R Update separated-hex helper default tabsize.
R/hexagonal_individual_pieces.R Update hex individual pieces default tabsize.
R/hexagonal_edge_generation_fixed.R Update hex edge-map pipeline defaults.
R/hexagonal_bezier_generation.R Update hex bezier pipeline defaults and examples.
R/geom_puzzle.R Update ggplot2 geom defaults + roxygen param text for tabsize.
R/config_utils.R Update fallback config defaults for styling tabsize.
R/concentric_individual_pieces.R Update concentric individual pieces default tabsize.
R/concentric_edge_generation.R Update concentric edge-map pipeline defaults.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread R/jigsawR_clean.R
Comment on lines 78 to 83
generate_puzzle <- function(type = "rectangular",
grid = c(3, 4),
size = c(400, 300),
seed = NULL,
tabsize = 10,
tabsize = 6,
jitter = 2,

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generate_puzzle() now defaults tabsize to 6, but generate_puzzle_batch()'s helper still assigns var$tabsize <- 20 when missing, causing inconsistent defaults between single and batch generation. Align the batch default with the new global default (and ideally reuse formals(generate_puzzle)$tabsize / config).

Copilot uses AI. Check for mistakes.
Comment on lines 63 to 67
#' min_tab_size = 10, max_tab_size = 30)
#' }
generate_tessellation_edge <- function(v1, v2, seed, edge_id,
tabsize = 20, jitter = 4,
tabsize = 6, jitter = 4,
tab_direction = 1,

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The roxygen still states @param tabsize default is 20, but the function signature now defaults to 6. Update the parameter documentation so users see the correct default (and range/meaning if applicable).

Copilot uses AI. Check for mistakes.
Comment on lines 24 to 28
#' @return List containing piece paths and metadata
generate_concentric_individual_pieces <- function(rings = 3, seed = NULL,
diameter = 240,
tabsize = 27, jitter = 5,
tabsize = 6, jitter = 5,
center_shape = "hexagon",

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The roxygen above this function still says tabsize default is 27 (and range 10-40), but the function now defaults to 6. Update the @param tabsize documentation to match the new normalized default/semantics.

Copilot uses AI. Check for mistakes.
Comment thread R/rectangular_puzzle.R
Comment on lines 265 to 269
#' @param xn Number of columns
#' @param yn Number of rows
#' @return List containing SVG path data
generate_jigsaw_svg <- function(seed = NULL, tabsize = 20, jitter = 4,
generate_jigsaw_svg <- function(seed = NULL, tabsize = 6, jitter = 4,
width = 300, height = 200,

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The roxygen for generate_jigsaw_svg() still documents tabsize as "(10-30)" and jitter as "(0-13)", which no longer matches the new normalized defaults/semantics (tabsize = 6, and tabsize described elsewhere as 0-100). Please update these parameter docs to stay consistent.

Copilot uses AI. Check for mistakes.
Comment thread R/hexagonal_puzzle.R Outdated
hex_puzzle <- generate_hex_jigsaw_svg(
seed = 1234,
tabsize = 27, # 27% (JS default)
tabsize = 6, # 27% (JS default)

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the example block, the inline comment still says "27% (JS default)" but tabsize is now set to 6. This is misleading—update the comment (and any mention of the old default) to match the new normalized default/semantics.

Suggested change
tabsize = 6, # 27% (JS default)
tabsize = 6, # Normalized tab size (equivalent to 27% in original JS)

Copilot uses AI. Check for mistakes.
Comment thread quarto/gallery/hexagonal.qmd Outdated
| `seed` | integer | random | Random seed for reproducibility |
| `offset` | numeric | 0 (mm) | Piece separation distance |
| `tabsize` | numeric | 10 (%) | Tab size as percentage of piece width |
| `tabsize` | numeric | 6 (%) | Tab size as percentage of piece width |

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter table still describes tabsize as a percentage of piece width. Tab sizing is based on edge length; updating this wording will better match the normalized tabsize semantics across puzzle types.

Suggested change
| `tabsize` | numeric | 6 (%) | Tab size as percentage of piece width |
| `tabsize` | numeric | 6 (%) | Tab size as percentage of edge length |

Copilot uses AI. Check for mistakes.
Comment thread quarto/gallery/random.qmd Outdated
Comment on lines 476 to 477
| `tabsize` | numeric | 6 (%) | Tab size as percentage of piece width |
| `jitter` | numeric | 2 (%) | Randomness in tab shape as percentage |

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter table still describes tabsize as a percentage of piece width, which is unclear for irregular random pieces. Since tab sizing is based on edge length, update the description accordingly.

Suggested change
| `tabsize` | numeric | 6 (%) | Tab size as percentage of piece width |
| `jitter` | numeric | 2 (%) | Randomness in tab shape as percentage |
| `tabsize` | numeric | 6 (%) | Tab size as percentage of edge length |
| `jitter` | numeric | 2 (%) | Randomness in tab shape as percentage of tab size |

Copilot uses AI. Check for mistakes.
Comment thread quarto/gallery/snic.qmd Outdated
Comment on lines 424 to 425
| `tabsize` | numeric | 6 (%) | Tab size as percentage of piece width |
| `jitter` | numeric | 2 (%) | Randomness in tab shape as percentage |

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter table still describes tabsize as a percentage of piece width, which is not well-defined for SNIC superpixel shapes. Since tab sizing is based on edge length, update the description accordingly.

Suggested change
| `tabsize` | numeric | 6 (%) | Tab size as percentage of piece width |
| `jitter` | numeric | 2 (%) | Randomness in tab shape as percentage |
| `tabsize` | numeric | 6 (%) | Tab size as percentage of local edge length |
| `jitter` | numeric | 2 (%) | Randomness in tab shape as percentage of tab size (based on edge length) |

Copilot uses AI. Check for mistakes.
Comment on lines 23 to 27
#' @return List containing piece paths and metadata
generate_hexagonal_individual_pieces <- function(rings = 3, seed = NULL,
diameter = 240,
tabsize = 27, jitter = 5,
tabsize = 6, jitter = 5,
output_dir = "output",

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The roxygen above this function still says tabsize default is 27 (and range 10-40), but the function now defaults to 6. Update the @param tabsize documentation to match the new normalized default/semantics.

Copilot uses AI. Check for mistakes.
Comment thread quarto/gallery/voronoi.qmd Outdated
| `seed` | integer | random | Random seed for reproducibility |
| `offset` | numeric | 0 (mm) | Piece separation distance |
| `tabsize` | numeric | 10 (%) | Tab size as percentage of piece width |
| `tabsize` | numeric | 6 (%) | Tab size as percentage of piece width |

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter table still describes tabsize as a percentage of piece width, which is not well-defined for Voronoi cells. Since tab sizing is based on edge length, update the description accordingly.

Suggested change
| `tabsize` | numeric | 6 (%) | Tab size as percentage of piece width |
| `tabsize` | numeric | 6 (%) | Tab size as percentage of edge length |

Copilot uses AI. Check for mistakes.
Fix hardcoded fallback values (jigsawR_clean.R, stat_puzzle.R,
main_generator.R), remove dead special-case logic in
individual_pieces_final.R, update all remaining roxygen @PARAM tabsize
docs to "(0-100). Default: 6.", fix stale hex comment, and correct
quarto wording from "piece width" to "edge length".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pjt222
pjt222 merged commit 2bfd340 into main Feb 11, 2026
0 of 4 checks passed
@pjt222
pjt222 deleted the feat/normalize-tabsize branch February 11, 2026 11:20
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