A One Line GA

Please post your software implementation of a GA that can be expressed in a single line of executable code.

Here’s mine:

#

A minimalist GA – Inspired by Allan Miller at TSZ

#
pop = Array.new(10) {“I AM APE-ISCH”}.map! {|ape| ape.dup}

The original population is copied and eliminated.

38 thoughts on “A One Line GA

  1. That’s not a GA. It’s doing a search. Or it’s not doing a search. Or whatever it is you usually say at this point, Mung.

  2. Here’s the shortest GA according to your apparent, though mistaken, understanding of what I have been saying:

    int a

    What’s that doing? In MungWorld it’s initialising a population with a single member and then allowing that genome to be replicated and immediately killed an unspecified number of times without mutation. Since we know the end result will be the same as the start, we can take the ‘algorithm’ part as read and save a few lines of code and a bit of processing power.

  3. Allan Miller: Since we know the end result will be the same as the start, we can take the ‘algorithm’ part as read and save a few lines of code and a bit of processing power.

    And given that you’ve “snuck” in the answer anyway, the IDers shout, you might as well just write:

    output = snuck_in_answer

    And leave it at that.

  4. Mung,

    So no more of that nonsense about whether or not I can write a GA.

    According to your understanding of what is involved, sure.

    arr a(1):=”I can write a GA, me”

  5. The one line GA implements both copying and elimination.

    If more than that is required to have a GA do let me know and I will adjust it accordingly.

    And no more nonsense about me not showing my code, either.

  6. I will accept it after you have submitted a full testing protocol, had it peer reviewed, and have implemented it and had your code pass.

  7. Ruby is fully tested and peer reviewed. My code passes the test the way keiths’ code passes the test.

  8. I’m waiting for the testing protocol. mung. Let’s see how you confirm that your program does what you say it does.

  9. petrushka: But you didn’t accept Keiths’ testing protocol.

    I didn’t see you complaining about it. If it works, it’s tested. Now all of a sudden you’re not happy with that?

  10. Mung: I didn’t see you complaining about it. If it works, it’s tested. Now all of a sudden you’re not happy with that?

    The question is, are you happy with that method of testing?

    I will accept your word as a gentleman that it runs without error.

    The question is, can you demonstrate that it does what you say it does?

  11. keiths: Mung’s hypocrisy is amusing.

    Meanwhile you continue to hold steady at lowest of the low here at TSZ. I bet you can sink even lower if you put some effort into it.

  12. petrushka: I will accept your word as a gentleman that it runs without error.

    That’;s not necessary. There are sites on the web that run Ruby code. You can see that it passes keiths’s rigorous testing requirements for yourself.

  13. petrushka: The question is, can you demonstrate that it does what you say it does?

    And what would that be? That it copies and eliminates? I already told you that those tests already exist so there’s no point in me writing them again.

    You’ll take my word as a gentleman. Right?

  14. Mung: You can see that it passes keiths’s rigorous testing requirements for yourself.

    I’m interested in seeing you apply the standard you insisted on for other people’s code.

  15. petrushka:
    Evolution visualized.

    http://www.theatlantic.com/science/archive/2016/09/stunning-videos-of-evolution-in-action/499136/

    “[W]hen Baym showed the videos at an evolutionary biology conference in Washington DC last month, many attendees were awed and slack-jawed.”

    Glad to know that my response was not due to lack of expertise in evolutionary biology.

    Petrushka, do please make an OP of this. You can embed the video by putting the following on a line by itself:

  16. You do see the double standard, don’t you.

    Keiths’ code passes his test, and so does your code. That’s consistent.

    Keiths doesn’t pass your test, but we are in the dark as to whether your code meets your own standards.

  17. Mung, to petrushka:

    I already told you that those tests already exist so there’s no point in me writing them again.

    If they already existed, you wouldn’t have to write them again.

    I think you’re revealing more than you intended.

  18. petrushka: You do see the double standard, don’t you.

    No, I don’t see any double standard. I don’t see the two scenarios as even remotely comparable. I find it amusing that you think they are.

  19. keiths: If they already existed, you wouldn’t have to write them again.

    Use the power of Google keiths.

    While you’re at it, google up some links on how to test for “the power of cumulative selection.”

  20. Mung: No, I don’t see any double standard. I don’t see the two scenarios as even remotely comparable. I find it amusing that you think they are.

    So basically you can’t demonstrate that your program does what you say it does.

  21. Mung,

    Why should I Google for tests that you’ve already written? Just post them.

    They do exist, don’t they?

  22. Okay, I used the power of google.

    ne must first have no shame. Then he/she must use a newspaper to find the obituary of a recently deceased man or woman. Then must find a buddy, with no shame, who will aid them in this act. The partners then go to the cemetary where they dig up their victim, and flip a coin. The loser, (or winner depending on how sick you are), applies his/her lips to the genitals or anus of the corpse, while the other partner procedes to climb the nearest tombstone and elbow drop the corpse’s stomach. Thus forcing out a blend of rich bodily fluids and embalming materials onto the partners. This blend is called mung. The act of getting this blend on your face is called munging. Chicks’ll dig this one.

    Is this what you meant?

  23. If you knew Ruby, keiths, you’d know that my code actually does not do what I claim it does and properly written tests would reveal that fact. But you don’t know Ruby and you’ve shown no ability to code or even understand a proper test.

    That’s what “it appears to work fine so it must be doing what I claim it does” gets for you. Yes, I’ve been making fun of you, again. Sadly it’s gone right over your head.

    Let me know if you want me to walk you through it.

  24. Poor keiths. Wouldn’t know if a test did what it was supposed to. Would want tests for the tests.

  25. keiths: Are your tests in Barry’s purse, along with your testicles?

    Wherever my testes are, they are having a good laugh at your expense wonder boy.

  26. Mung: Let me know if you want me to walk you through it.

    Are you just not interested in learning keiths, or is it that you cannot learn anything from an IDiot? A running program does not guarantee that the program is performing as advertised. Are you willing to admit that yet?

  27. So say I post tests.

    Does petrushka somehow manage to travel back in time and demand that keiths posts his tests?

    I’m going to bet on the DONT PASS line on that one.

  28. petrushka: So basically you can’t demonstrate that your program does what you say it does.

    It is possible to create a collection of objects in which every member of that collection is a reference to the exact same object when that may not have been the intent at all. The program may still run, it may pass every test if the only requirement for testing is that it runs, but that doesn’t mean much.

Leave a Reply