0


文字列(長さが異なる単語)のリストとint(データセットのサイズ、たとえばint値4はテーブルの4列と4行になります)を受け取る関数を作成する必要があります。これを使用して、リスト内のできるだけ多くの単語を保持するブロック(データセットであるブロック)のようなクロスワードを生成します。クロスワードのように、文字が適切な場所で一致する場合、それらは互いに交差する可能性があり、単語はすべて混同する必要があります、あらゆる方向に読んでください(クロスワードパズルのように)。

これを支援するコードが見つからないようです。これまでのところ、データセットの基本構造はわかっています。これで、助けていただければ幸いです。

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++)

}
4

1 に答える 1

2

You could just use a two-dimensional array to hold the characters. I guess the tricky part is from the word list work out where there a letter is shared between two words. I guess start with the least frequently used letter and work from there!

Interesting Article
http://blogs.teamb.com/craigstuntz/2010/01/11/38518/

Stack Overflow Question may help (although in c++ - might be of use)
Best data structure for crossword puzzle search

Other links to code generators.
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=6082&lngWId=10
http://dotnetslackers.com/articles/net/Creating-a-programming-crossword-puzzle.aspx
One in c
http://pdos.csail.mit.edu/cgi-bin/theme-cword

于 2010-12-09T09:44:50.627 に答える