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

Thread: Problem in simple evolution simulator..

  1. #1
    Junior Member
    Join Date
    Jul 2017
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem in simple evolution simulator..

    Hello,
    I am creating a very simple evolution simulator in Processing.
    It is a simple game where you must move the player around some terrain (circles that I call rocks).
    There are 50 randomly generated creatures (brains) that each try to play this game.
    At the end of a generation (50 creatures), half of the creatures (the worst performing ones) are killed off and the other half each get one slightly randomized offspring.
    Here is the problem :
    Sometimes, the best creature gets worse from one generation to the other. I don't know if it's getting randomized or getting killed, but I do know it shouldn't happen.
    I've been trying to fix this, for days and I haven't found any solution!

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,382
    Thanks
    53
    Thanked 2,398 Times in 2,351 Posts

    Default Re: Problem in simple evolution simulator..

    How are you trying to debug the code to understand why it works like it does?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jul 2017
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem in simple evolution simulator..

    The "creatures" try to go to the top right of the screen.
    They are sorted based on the distance from the top right.

    Every step of the sort, I output in the console each creature's distance. So it would look like this, but with more numbers.
    980, 560, 320, 1080
    560, 320, 980, 1080
    320, 560, 980, 1080

    How ever, in the next generation, for some reason there is a chance the 320 would be gone and the 560 takes it's place..

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,382
    Thanks
    53
    Thanked 2,398 Times in 2,351 Posts

    Default Re: Problem in simple evolution simulator..

    the 320 would be gone and the 560 takes it's place
    Can you add some debug code to print out when that happens and why it happens?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Jul 2017
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem in simple evolution simulator..

    That's what I'm trying to find out!
    What is making the best creature worst/die?

Similar Threads

  1. simple tourney simulator question
    By Worst Programmer Ever in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 17th, 2013, 08:05 AM
  2. please help, simple problem
    By grandmst in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 13th, 2011, 05:26 PM

Tags for this Thread