| Title: | Read/Write Crosswords in PUZ Format |
|---|---|
| Description: | Read and write crosswords in the standard PUZ format. |
| Authors: | Mike Cheng [aut, cre, cph] |
| Maintainer: | Mike Cheng <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-25 07:35:39 UTC |
| Source: | https://github.com/coolbutuseless/crosswordio |
Create a simple plot of a crossword
plot_puz(grid, across, down, add_position = TRUE, scale = 20, cex = 0.95)plot_puz(grid, across, down, add_position = TRUE, scale = 20, cex = 0.95)
grid |
character matrix containing the solution to the crossword. Non-letter grid squares (i.e. black squares) are denoted by the "." character. |
across, down
|
cahracter vectors for the across and down clues in
the order they appear when traversing the puzzle grid row-by-row.
Note: Text should be utf8, convert if necessary e.g.
|
add_position |
Add position indices to the start of the text for the clues. |
scale |
overall scale applied to grid size and text size. Default: 20 |
cex |
extra adjustment factor for text size of clues. Default: 0.95 |
None.
Plot a crossword PUZ
## S3 method for class 'puz' plot(x, ...)## S3 method for class 'puz' plot(x, ...)
x |
PUZ object |
... |
passed to |
None
Read a crossword file in PUZ format
read_puz(puz_file)read_puz(puz_file)
puz_file |
filename |
named list of crossword information
# This grid is the "Sator Square" grid <- matrix(c( "S", "A", "T", "O", "R", "A", "R", "E", "P", "O", "T", "E", "N", "E", "T", "O", "P", "E", "R", "A", "R", "O", "T", "A", "S" ), 5, 5, byrow = TRUE) # In the Sator Square, all down and across words are identical # and in Latin! down <- across <- c( "sower, planter", "unknown word, perhaps a proper name of a non-Latin origin", "holds, keeps, comprehends, possesses, masters, preserves, sustains", "service, pains, labor; care, effort, attention", "wheels" ) # Write crossword to a file in "puz" format file <- tempfile() write_puz( grid = grid, across = across, down = down, title = "SATOR SQUARE", file = file ) # Read the data back read_puz(file)# This grid is the "Sator Square" grid <- matrix(c( "S", "A", "T", "O", "R", "A", "R", "E", "P", "O", "T", "E", "N", "E", "T", "O", "P", "E", "R", "A", "R", "O", "T", "A", "S" ), 5, 5, byrow = TRUE) # In the Sator Square, all down and across words are identical # and in Latin! down <- across <- c( "sower, planter", "unknown word, perhaps a proper name of a non-Latin origin", "holds, keeps, comprehends, possesses, masters, preserves, sustains", "service, pains, labor; care, effort, attention", "wheels" ) # Write crossword to a file in "puz" format file <- tempfile() write_puz( grid = grid, across = across, down = down, title = "SATOR SQUARE", file = file ) # Read the data back read_puz(file)
Create a crossword in '.puz' format
write_puz( grid, across, down, title = "", author = "", copyright = "", notes = "", file = NULL )write_puz( grid, across, down, title = "", author = "", copyright = "", notes = "", file = NULL )
grid |
character matrix containing the solution to the crossword. Non-letter grid squares (i.e. black squares) are denoted by the "." character. |
across, down
|
cahracter vectors for the across and down clues in
the order they appear when traversing the puzzle grid row-by-row.
Note: Text should be utf8, convert if necessary e.g.
|
title, author, copyright, notes
|
free text strings giving information
about the crossword. Default: empty string.
Note: Text should be utf8, convert if necessary e.g.
|
file |
filename for output. Default: NULL means to return the raw vectors. |
Returns raw vector of data if no filename is set, otherwise returns nothing.
# This grid is the "Sator Square" grid <- matrix(c( "S", "A", "T", "O", "R", "A", "R", "E", "P", "O", "T", "E", "N", "E", "T", "O", "P", "E", "R", "A", "R", "O", "T", "A", "S" ), 5, 5, byrow = TRUE) # In the Sator Square, all down and across words are identical # and in Latin! down <- across <- c( "sower, planter", "unknown word, perhaps a proper name of a non-Latin origin", "holds, keeps, comprehends, possesses, masters, preserves, sustains", "service, pains, labor; care, effort, attention", "wheels" ) # Write crossword to a file in "puz" format file <- tempfile() write_puz( grid = grid, across = across, down = down, title = "SATOR SQUARE", file = file ) # Read the data back read_puz(file)# This grid is the "Sator Square" grid <- matrix(c( "S", "A", "T", "O", "R", "A", "R", "E", "P", "O", "T", "E", "N", "E", "T", "O", "P", "E", "R", "A", "R", "O", "T", "A", "S" ), 5, 5, byrow = TRUE) # In the Sator Square, all down and across words are identical # and in Latin! down <- across <- c( "sower, planter", "unknown word, perhaps a proper name of a non-Latin origin", "holds, keeps, comprehends, possesses, masters, preserves, sustains", "service, pains, labor; care, effort, attention", "wheels" ) # Write crossword to a file in "puz" format file <- tempfile() write_puz( grid = grid, across = across, down = down, title = "SATOR SQUARE", file = file ) # Read the data back read_puz(file)