Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1

    Default [VB 6] "Knight's Tour" help needed


    this is a school assignment, but I won't be asking for complete programs, just the right direction.

    I need to make a Knight's Tour program in VB6.
    I'm having trouble starting out..

    What object should I use for the 'cells'? (we are only allowed to use the default objects).

    I tried using Labels(with backcolor) and putting them in control arrays, but I think i need to put them in 2D arrays. How do I put objects in 2D arrays?

  2. #2
    i think something like this

    Dim Board(0 To 11, 0 To 11) As <datatype>

  3. #3
    I am using Label objects with black or white background colors for the cells. I just copied&pasted them to form a grid, which VB6 automatically creates a 1D 'control array'.
    so now I have an array cell(0 To 63) with Label objects inside.
    But I want to put those Labels in a 2D array.. I tried using a For loop
    Code:
    Dim Board(0 To 7, 0 To 7) As Label
    Dim counter As Integer
    
    For i = 0 to 7
       For j = 0 To 7
          Board(i, j) = cell(counter)
          counter = counter + 1
       Next j
    Next i
    but that throws an error, in the line 'Board(i, j) = cell(counter)

  4. #4
    im sorry im abit out dated with my vb6 skills eheheh whats that cell(counter) code for?

    is it supposed to return a label control?

    i think this is what you need...

    since you already have an array of control...

    youll need something like

    public function ConvertToIndex(x,y) as integer
    public function IndexToXY(index) as pointStruct
    ...
    ...

    you'll get the label index

    you might also need a function...
    MarkedAsPass(x,y) ' which will mark a label that it has been passed...

    if i were to do this.. i wouldnt use labels... but instead ill use GDI

  5. #5
    cell(counter) gets the Label in the cell control array.

    so what you're suggesting is I just stick to the 1D control array created by VB6, and just use functions to get the XY positions of the labels?

    What are GDI's?

  6. #6
    yep if you can do that... youll need to place those labels in the right order though

    0 | 1 | 2 | 3 | 4
    5 | 6 | 7 | 8 | 9
    ....

    GDI is a graphics library for windows.... so you dont use labels as your blocks
    but its more complicated lol. research about BitBlt if your interested

    you can do this with GDI + an array of boolean

    dim PassedBlocks (0 to 11 , 0 to 11) as Boolean

  7. #7
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    why not try to search around first? a lot of example programs though available for you. using GDI you can make a grid like environment.

    so what you're suggesting is I just stick to the 1D control array created by VB6, and just use functions to get the XY positions of the labels?
    you can achieved this through a proper naming conventions of your variable.

  8. #8
    we are only allowed to use the default objects (Labels, Textboxes, etc.)

  9. #9
    aw sorry.... what school bro?
    we are only allowed to use the default objects (Labels, Textboxes, etc.)
    lol thats actually funny... if you want to learn you need to explore

  10. #10
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    then use labels... you can changed the background of the labels to track the knights movement

  11.    Advertisement

Page 1 of 2 12 LastLast

Similar Threads

 
  1. unlocking SE fones... help needed!
    By Phoenix8 in forum Gizmos & Gadgets (Old)
    Replies: 2
    Last Post: 01-04-2012, 06:34 PM
  2. Siemens SL56 - HELP Needed
    By for_real in forum Gizmos & Gadgets (Old)
    Replies: 2
    Last Post: 11-19-2005, 02:43 AM
  3. help:. need software of karaoke maker or builder
    By untitledhero in forum Software & Games (Old)
    Replies: 1
    Last Post: 09-03-2005, 10:33 AM
  4. HELP!!!! Need a plce to rent in cebu....
    By lynn in forum Support Center
    Replies: 2
    Last Post: 07-02-2005, 10:22 AM
  5. help needed for palm m105
    By eliel73173 in forum Gizmos & Gadgets (Old)
    Replies: 6
    Last Post: 04-29-2005, 01:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top