Crossword: Crossword

Description Usage Format Fields Methods Examples

Description

Crossword

Usage

1

Format

An R6Class generator object for generating crosswords from word lists

Fields

letters

a character matrix representing the grid of the crossword

words

a data.frame like (tibble) storing words, their position on the grid (row, col), their length in character, their direction ("right", "down") the word and the clue

Methods

add_words(words, clues = NULL)

this method will try to add words to the crossword by placing it on the grid; clues is optional and should be the same length;

density()

gives back statistics on fill state of grid

to_json(pretty = FALSE)

thi exports grid and word list data to JSON for external usage; pretty parameter determines if this is done in a human readable or more machine efficient way

Examples

1
2
3
4
5
6
7
library(crossword.r)
cw <- Crossword$new(rows = 4, columns = 4)
cw$add_words(c("back", "nasa", "kick", "nuk", "ic", "sic"))
cw
cw$letters
cw$words
cw$density()

crossword.r documentation built on May 2, 2019, 12:34 p.m.