word_search: Word search

Description Usage Arguments Value Examples

Description

This function recursively searches for all words available when starting with a given cell.

Usage

1
word_search(idx, fragment, indices, results, board, nb)

Arguments

idx

The cell where the character string (fragment) originates.

fragment

A character string being tested.

indices

The indexes of the cells of the character string being tested.

results

A list of words and indices.

board

The scrabble board in play.

nb

The matrix representing neighboring cells.

letters

The character string being tested.

Value

A list of words and their indices on the boggle board.

Examples

1
2
3
4
5
6
7
8
# Search for all words originating with the first upper
# left-hand cell.
board        <- random_board()
padded_board <- cbind(NA,rbind(NA,board,NA),NA)
nb           <- neighbors(padded_board)
results      <- list(words=c(),indices=c())
idx          <- 1
word_search(idx, board[idx], c(idx), results, board, nb)

ezgraphs/rbogglesolver documentation built on May 16, 2019, 9:56 a.m.