Welcome to our forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Forum Statistics

  • Forum Members:
  • Total Threads:
  • Total Posts: 1
There are 1 users currently browsing forums.
.Net Programming A powerful framework built by Microsoft to facilitate development in Windows platforms.

Reply
  #1  
Old 11-29-2009
Child
 
Join Date: Oct 2008
Location: Israel
Age: 27
Posts: 79
Rep Power: 2
Dimkin is on a distinguished road
Help to solve some Interesting problem...

Hello, I got this program I want to write. I know that you will not solve the problem for me, but, I don't even know where to start. So, If you could guide me even to the starting point I guess this will do it.

Imagine a square field, 5X5 cells. every field can contain a letter. (example 1)


example 1

Every time a letter added I need to build an algorithm that will find any sequence of characters that has at least one free cell near the end of that sequence. (example 2)


Example 2

On example 2 these are only part of the possibilities, and I need ALL of them. I guess this algorithm is something recursive but my knowledge on this topic is very limited. I can't even understand the logic of how it should be done.

So far, I have the cells and a two dimensional array of textboxes:
Code:
            TextBox[,] chars = new TextBox[5, 5];
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    chars[i, j] = new TextBox()
                    {
                        Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(177))),
                        Location = new System.Drawing.Point(150 + (31 * j), 12 + (31 * i)),
                        MaxLength = 1,
                        Name = string.Format("txtbox{0}{1}",j,i),
                        Size = new System.Drawing.Size(29, 29),
                        TabIndex = 0,
                        Text = "",
                        Parent = this,
                        TextAlign = System.Windows.Forms.HorizontalAlignment.Center,
                    };
                }
            }
I also thought to drop all the letters into one list of chars and then combine all the possible sequences for 2letters, 3letters, etc... and then check them if they meet the criteria of a free cell at the end, but, I guess this will be very time consuming.

So any idea will be helpful!
Thanks in advance!
-Dimkin
Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can u solve this problem ?? (programming skill survey) foxinema C and C++ Programming 4 03-30-2008 06:32 AM
PHP and Javascript Problem johnnie PHP Scripting 3 03-28-2006 11:32 AM
Linux: Binary packages, to solve the un-uninstallable source package problem _jameshales Articles, Tutorials, and Guides 4 01-08-2006 11:54 PM