Visual Basic

Discussion in 'New Members Introduction' started by ptheodule, Mar 24, 2008.

  1. ptheodule

    ptheodule New Member

    2
    0
    1
    I have a project that is due tomorrow @ 11:59P.M. I have a 4X4 board, broken down into four regions, each button is allowed to have a number from one to four. A button can not have a duplicate number in it's row column or region. This criteria must be met to generate a valid board. I was able to generate the random number for each of the sixteen buttons, but I am unable to find a way to check the buttons against each other. I tried to use IF THEN statements and a DO LOOP and it still does not work. If anyone can give me some directions or helpful tips it will be greatly appreciated.
     
  2. Mathematix

    Mathematix Megabyte Poster

    969
    35
    74
    The reason why it's not working is because you haven't told your program what is a 'row' and what is a 'column'. Conditionals are there to confirm that a state is valid, which is not the same as an implementation of the state - so that's where your program falls apart.

    I'm not a VB guru in the slightest, so hopefully someone who is can give you an idea of the implementation for what I have described above.

    Good luck!
     
    Certifications: BSc(Hons) Comp Sci, BCS Award of Merit
    WIP: Not doing certs. Computer geek.
  3. dmarsh
    Honorary Member 500 Likes Award

    dmarsh Petabyte Poster

    4,305
    503
    259
    Well thats because you need to design an algorithm, you could try a brute force or monte carlo type algorithm. A better approach would be to find constraints that limit the problem space.

    A gird can be implemented using a multidimensional array. You then prob want some functions like, check row and check column and check region. You'd probably be better off using a semi inteligent placing algorithm rather than placing the numbers randomly. As the grid fills up the problem space diminishes...

    For more on algorithms look at Robert Sedgewick his stuffs a bit more accessible than Donald Knuths.
     
  4. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    I'd agree with dmarsh - building the board while checking would seem a better way than placing the buttons randomly then trying to adjust them.

    If I understand the requirements correctly then the 'unique in block' requirement degenerates to checking the opposite corner of the block.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  5. wizard

    wizard Petabyte Poster

    5,767
    42
    174
    Hi there and welcome 8)
     
    Certifications: SIA DS Licence
    WIP: A+ 2009
  6. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Hadn't noticed that this was a first post!

    So welcome to CF from me as well!

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  7. Notes_Bloke

    Notes_Bloke Terabyte Poster

    3,230
    54
    146
    Hi & welcome to CF:D

    NB
     
    Certifications: 70-210, 70-215, A+,N+, Security+
    WIP: MCSA
  8. nugget
    Honorary Member

    nugget Junior toady

    7,796
    71
    224
    Hi and welcome to the forum. :biggrin
     
    Certifications: A+ | Network+ | Security+ | MCP (270,271,272,290,620) | MCDST | MCTS:Vista
    WIP: MCSA, 70-622,680,685
  9. ThomasMc

    ThomasMc Gigabyte Poster

    1,507
    49
    111
    how did you get on with your assignment?
     
    Certifications: MCDST|FtOCC
    WIP: MCSA(70-270|70-290|70-291)
  10. GiddyG

    GiddyG Terabyte Poster Gold Member

    2,471
    42
    140
    Welcome to CF! 8)
     

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.