Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: General Question; Need Ideas

  1. #1
    Member clydefrog's Avatar
    Join Date
    Feb 2012
    Posts
    67
    Thanks
    15
    Thanked 2 Times in 2 Posts

    Default General Question; Need Ideas

    Hi,

    I beginning work on a personal project but before i began and dove blindly into this, i like to get some opinions from more experienced users. I'm not asking for code, just ideas or techniques that will help me implement this.

    Basically, in order to move further with my project i need to figure out a way to randomly assemble a set of premade pieces on a grid based board. The conditions being that they are all interconnected and continuous; however as i go alone i will add more conditions, for now that is enough though. Also, this will be be random generation, so the generated structure will look different each time. Because pictures speak a thousand words, im going to post pictures to aid my question.

    For instance, here is the grid:
    board.jpg

    And here are the premade Pieces:
    pieces.jpg

    After assembling, here is what it might look like(Notice how its all continuous, even if it may have dead ends):
    correctassemble.jpg

    This would be an INCORRECT way of assembling(Notice how there is a gap between the two structures, there is no way to get to the second structure from the first):
    incorrectassemble.jpg

    So what do you guys think? How would you go about doing this? Any tips, thoughts, ideas, first impressions, guesses, etc? Essentially i need a place to start, and i'll go from there to see if it pans out.

    Thanks a bunch


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,372
    Thanks
    183
    Thanked 836 Times in 779 Posts
    Blog Entries
    5

    Default Re: General Question; Need Ideas

    You could start from a pre-made template - for instance the one you posted - then start randomly moving and swapping pieces to different (random but valid) locations. This would be similar in concept to how one can create a Sudoku puzzle - start from a solved one then shuffle the appropriate rows and columns and voila.

  3. The Following User Says Thank You to copeg For This Useful Post:

    clydefrog (March 28th, 2012)

  4. #3
    Member clydefrog's Avatar
    Join Date
    Feb 2012
    Posts
    67
    Thanks
    15
    Thanked 2 Times in 2 Posts

    Default Re: General Question; Need Ideas

    hmmm, interesting idea; i hadnt considered that, that might be able to get me started. thanks

    anyone else?

Similar Threads

  1. Any ideas?
    By ahender1 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 2nd, 2012, 03:58 PM
  2. General Question
    By Becca in forum Collections and Generics
    Replies: 6
    Last Post: November 3rd, 2011, 04:52 PM
  3. Just a general Java related question
    By javaisfun in forum Java Theory & Questions
    Replies: 3
    Last Post: October 25th, 2011, 08:21 AM
  4. Newbie: general question on trying to get a simple Pokemon game to work
    By willmer in forum Object Oriented Programming
    Replies: 7
    Last Post: July 13th, 2011, 08:33 AM
  5. Running out of ideas...
    By Cat in forum What's Wrong With My Code?
    Replies: 6
    Last Post: March 12th, 2011, 11:21 AM