permutation_solver: permutation_solver

View source: R/permutation_solver.R

permutation_solverR Documentation

permutation_solver

Description

Given a row or column pattern and the set of all possible permutations of the row/column's length, permutation_solver identifies the set of permutations that satisfy the pattern

Usage

permutation_solver(
  pattern,
  permutation_patterns,
  full_patterns = NULL,
  verbose = TRUE
)

Arguments

pattern

A numeric vector where each element corresponds to the length of a run.

permutation_patterns

A matrix of permutations as generated by make_full_perm_set()

full_patterns

A list where each element is a numerical run length encoding corresponding to the rows in the permutation_patterns matrix. If NULL (default), the run length encodings will be calculated by the function.

Value

A matrix with the same number of columns as the permutation_patterns argument, and the same number of rows as there are matches.

Examples

full <- make_full_perm_set(10)
permutation_solver(c(2, 4, 1), full)

hrj21/nonogram documentation built on April 6, 2024, 1:14 a.m.