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 2 of 2

Thread: Beginner programmer... no idea how to implement this properly

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Beginner programmer... no idea how to implement this properly

    Pretty much I'm making an n x n grid. The goal of the grid is to find a path from the top to the bottom by randomly opening cells. All cells start off blocked. Now here's what I can't figure out.

    I need to create this grid (an array) and make pointers to each cell so that I can then traverse the array in order and select a blocked site to open in constant time at each step. I can't figure out how to do this in java though. If anyone could shed some light it would be very much appreciated.


  2. #2
    Member DanBrown's Avatar
    Join Date
    Jan 2011
    Posts
    134
    My Mood
    Confused
    Thanks
    1
    Thanked 12 Times in 12 Posts

    Default Re: Beginner programmer... no idea how to implement this properly

    Firstly i would like to know , are you comfortable with swing or not ?
    secondly, talking about logic.

    an array as you planned can be used for storing the locations of the board which are currently open for the movement.

    for generating random array, you can use java random class.
    for utilizing space you can you sparse array.[only valid positions or the positions open for the movement.]
    Thanks and Regards
    Dan Brown

    Common Java Mistakes

Similar Threads

  1. I cannot get boolean to work properly
    By kl2eativ in forum What's Wrong With My Code?
    Replies: 9
    Last Post: January 18th, 2011, 07:37 AM
  2. want to implement security key feature in the software
    By javasabin in forum Member Introductions
    Replies: 2
    Last Post: January 8th, 2011, 01:52 AM
  3. Construct a class that implement ActionListener with no constructor
    By striko_514 in forum Java Theory & Questions
    Replies: 1
    Last Post: July 5th, 2010, 03:15 PM
  4. if else statement not working properly
    By tina G in forum Algorithms & Recursion
    Replies: 1
    Last Post: March 29th, 2010, 08:04 AM
  5. Implement dragging a circle
    By jolly in forum AWT / Java Swing
    Replies: 0
    Last Post: August 19th, 2009, 02:48 PM