I have to write a function that takes a list of string(words that vary in length), and an int(size of data set eg. int value of 4 will be 4 columns and four rows in table), and with this I must produce a crossword like block(block being the dataset) that will hold as many of the words in the list as possible, like a crossword they can cross each other if the letters match at the right places, and the words must be all mixed up, read in every direction(like a crossword puzzle).
I can't seem to find code to help me with this, so far I have the basic structure of the dataset, here it is, any help will be appreciated, thanks.
public WordsDs WordMixer(List<string> wordList, int size)
{
if ((wordList == null) || (size < 2))
{
return null;
}
//shuffle the words in the list so that they are in a random order
Random random = new Random();
var sortedList = wordList.OrderBy(i => random.Next()).ToList();
//create a dataset for the words
DataSet ds = new DataSet();
DataTable dt = new DataTable();
//add columns and rows according to the size parameter
for (int i = 0; i < size; i++)
{
dt.Columns.Add(i.ToString(), typeof(string));
}
for (int i = 0; i < size; i++)
{
dt.Rows.Add(i);
}
for (int i = 0; i < wordList.Count; i++)
{
}//for (int i = 0; i < wordList.Count; i++)
}