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

Thread: 15 square puzzle

  1. #1
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: 15 square puzzle

    once the puzzle is solved I have a message pop up that says the puzzle is solved but then once I go to shuffle the board again sometimes that message will appear again then the board will shuffle
    Sounds like a logic problem. Are there variables with incorrect values causing it to happen? Have you tried debugging by adding some println statements that print out the values of the variables that control the logice flow for what is happening?
    If you don't understand my answer, don't ignore it, ask a question.


  2. #2
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: 15 square puzzle

    Quote Originally Posted by Norm View Post
    Sounds like a logic problem. Are there variables with incorrect values causing it to happen? Have you tried debugging by adding some println statements that print out the values of the variables that control the logice flow for what is happening?
    I have tried debugging in eclipse with some breakpoints it just does not make sense because it occurs once like the puzzle has been solved for like the third time.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: 15 square puzzle

    once like the puzzle has been solved for like the third time.
    Debugging takes patience. Sometimes printlns are better because they can be faster than the interactive debug. Especially if the error doesn't happen every time.
    If you don't understand my answer, don't ignore it, ask a question.

  4. #4
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: 15 square puzzle

    Quote Originally Posted by Norm View Post
    Debugging takes patience. Sometimes printlns are better because they can be faster than the interactive debug. Especially if the error doesn't happen every time.
    Okay thanks for the help. I will give it a try. Then onto figuring out how to allow the buttons to move twice

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: 15 square puzzle

    For quicker testing, change the shuffle method to create a position that is one move from a win.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: 15 square puzzle

    Quote Originally Posted by Norm View Post
    For quicker testing, change the shuffle method to create a position that is one move from a win.
    I believe I have solved the problem. I just added another variable and has it set back to zero aside form using my variable for the number of plays because I think it would go back and check the condition of the loop and it would be true for the that p value and fall back in.

Similar Threads

  1. Puzzle Game. Need some help
    By clydefrog in forum Java Theory & Questions
    Replies: 10
    Last Post: March 12th, 2012, 03:14 PM
  2. [SOLVED] Method help, one thing then another - puzzle
    By Scotty in forum Java Theory & Questions
    Replies: 3
    Last Post: April 28th, 2011, 01:52 PM
  3. Search Word puzzle game
    By lew1s in forum What's Wrong With My Code?
    Replies: 6
    Last Post: April 9th, 2011, 04:23 AM
  4. JavaScript pic puzzle
    By fr334a11 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 25th, 2011, 08:29 AM
  5. [SOLVED] Problem in implementation of Fifteen Puzzle with 2D Arrays
    By bruint in forum Collections and Generics
    Replies: 8
    Last Post: May 3rd, 2009, 10:37 PM