Description Usage Arguments Value Examples
make a state (or goal conditions) of a puzzle
1 | makeState(pieces)
|
pieces |
a list of objects of 'slidepzl_piece' class. They can have NAs in their locations. |
an object of class 'slidepzl_state', which is a list with following elements:
a character vector, whose ith element gives the 'type' of ith piece.
a numeric matrix of size (k, 2), where k is the number of pieces on the board. The ith row gives (row, column) of the upper left corner of the ith piece. It can have NAs.
Validity of the state is not guaranteed.
1 2 3 4 5 6 7 8 9 10 11 12 13 | mystate <- makeState(
list(
makePiece(type = "A", loc = c(1,1)),
makePiece(type = "B", loc = c(1,2)),
makePiece(type = "C", loc = c(1,3)),
makePiece(type = "D", loc = c(2,1)),
makePiece(type = "E", loc = c(2,2)),
makePiece(type = "F", loc = c(2,3)),
makePiece(type = "G", loc = c(3,1)),
makePiece(type = "H", loc = c(3,2))
)
)
mystate
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.