Table of Contents

Method FillGridWithWords

Namespace
Gamelogic.Words.Grids
Assembly
Gamelogic.Words.dll

FillGridWithWords(IGrid<GridPoint2, string>, IWordAlphabet, IEnumerable<Word>, Func<GridPoint2, int, bool, GridPoint2>, int, IRandom)

Fills a grid with a given collection of words, providing the valid reading directions for the words

public static List<Word> FillGridWithWords(IGrid<GridPoint2, string> grid, IWordAlphabet alphabet, IEnumerable<Word> words, Func<GridPoint2, int, bool, GridPoint2> directionFunction, int directionCount, IRandom random)

Parameters

grid IGrid<GridPoint2, string>

The grid to fill. Must be a grid of strings

alphabet IWordAlphabet

The alphabet to use

words IEnumerable<Word>

The words to attempt to place inside the grid

directionFunction Func<GridPoint2, int, bool, GridPoint2>

A function to walk the given grid in a direction specified by some index

directionCount int

The number of valid indices to directionFunction

random IRandom

The random generator to use.

Returns

List<Word>

The words successfully added to the grid

Remarks

This function will not clear the grid in advance. It will attempt to place words in null or empty cells in the grid, around existing elements if they exist. It is not guaranteed to fit all the words in the grid

FillGridWithWords(AbstractGrid<GridPoint2, string>, IWordAlphabet, IEnumerable<Word>, IRandom)

Fills a grid with a given collection of words

public static List<Word> FillGridWithWords(AbstractGrid<GridPoint2, string> grid, IWordAlphabet alphabet, IEnumerable<Word> words, IRandom random)

Parameters

grid AbstractGrid<GridPoint2, string>

The grid to fill. Must be a grid of strings

alphabet IWordAlphabet

The alphabet to use

words IEnumerable<Word>

The words to attempt to place inside the grid

random IRandom

The random generator to use.

Returns

List<Word>

Remarks

This function will not clear the grid in advance. It will attempt to place words in null or empty cells in the grid, around existing elements if they exist. It is not guaranteed to fit all the words in the grid