Natural selection help and stuff

Hello, I have recently ran into a problem with my natural selection simulator thingy. The entire point is that life is supposed to copy itself with a five percent chance for one of the letters to change slightly, the lifeforms that have positive changes live to reproduce while the lifeforms that have negative changes die out rather quickly. Any ideas on generating and reading this?

Here’s some screenshots of my code.

2 Likes

give me a sec and I’ll see if I can come up with anything

I’m rly confused, for 5% chance do 1 - 100 and less than or = to 5 and generate.

2 Likes

I’m not fully understanding your code so I made this. I think this would work.

Code to trait making

{“data”:{“behavior”:{“v”:“2”,“nodes”:[{“inputCount”:0,“outputCount”:1,“name”:“Once”,“behaviorType”:“logic.triggers.Once”,“x”:-720,“y”:-1408,“group”:"",“id”:“55e3c52684a19a42”,“resetOnLevelStart”:false},{“inputCount”:3,“outputCount”:1,“name”:“Random”,“behaviorType”:“logic.logic.Random”,“x”:-360,“y”:-1408,“group”:"",“id”:“55e3d6660a9bc148”,“notes”:“5% chance for new trait”,“n_o”:1,“min”:1,“max”:20},{“gateVal”:10,“mode”:“equal to”,“inputCount”:2,“outputCount”:2,“name”:“Filter”,“behaviorType”:“logic.logic.Filter”,“x”:-180,“y”:-1408,“group”:"",“id”:“55e481f58d950343”},{“inputCount”:3,“outputCount”:1,“name”:“Random”,“behaviorType”:“logic.logic.Random”,“x”:0,“y”:-1408,“group”:"",“id”:“55e4f37a5a060240”,“notes”:“50% chance good, 50% chance bad”,“n_o”:1,“min”:1,“max”:2},{“gateVal”:2,“mode”:“equal to”,“inputCount”:2,“outputCount”:2,“name”:“Filter”,“behaviorType”:“logic.logic.Filter”,“x”:-540,“y”:-1152,“group”:"",“id”:“55e52a0c31b4a447”},{“gateVal”:1,“mode”:“equal to”,“inputCount”:2,“outputCount”:2,“name”:“Filter”,“behaviorType”:“logic.logic.Filter”,“x”:-540,“y”:-1280,“group”:"",“id”:“55e52ad8c0eef649”},{“inputCount”:3,“outputCount”:1,“name”:“Number”,“behaviorType”:“logic.logic.Value”,“x”:-360,“y”:-1152,“group”:"",“id”:“55e63c5debc6f441”,“startVal”:1,“tag”:“Bad”,“roundMode”:1},{“inputCount”:3,“outputCount”:1,“name”:“Number”,“behaviorType”:“logic.logic.Value”,“x”:-360,“y”:-1280,“group”:"",“id”:“55e63ec5c9a29b4e”,“startVal”:1,“tag”:“Good”,“roundMode”:1},{“inputCount”:3,“outputCount”:1,“name”:“Number”,“behaviorType”:“logic.logic.Value”,“x”:-90,“y”:-1088,“group”:"",“id”:“55ec3c951a4a1248”,“startVal”:0,“tag”:“Number Of Bad”,“roundMode”:1},{“inputCount”:3,“outputCount”:1,“name”:“Number”,“behaviorType”:“logic.logic.Value”,“x”:-90,“y”:-1248,“group”:"",“id”:“55ec3d1f30e9d44d”,“startVal”:0,“tag”:“Number Of Good”,“roundMode”:1},{“inputCount”:0,“outputCount”:1,“name”:“Mailbox”,“behaviorType”:“logic.components.Mailbox”,“x”:-360,“y”:-1024,“group”:"",“id”:“55f3561e70647741”,“msg”:“bad traits”},{“inputCount”:0,“outputCount”:1,“name”:“Mailbox”,“behaviorType”:“logic.components.Mailbox”,“x”:-540,“y”:-1024,“group”:"",“id”:“55f356c931922d4c”,“msg”:“good traits”},{“delay”:2,“count”:1,“version”:2,“inputCount”:3,“outputCount”:1,“name”:“Timer”,“behaviorType”:“logic.triggers.Timer”,“x”:-540,“y”:-1408,“group”:"",“id”:“55f5b874ba69984b”}],“links”:[{“input_id”:“55f5b874ba69984bi0”,“output_id”:“55e3c52684a19a42o0”},{“input_id”:“55e3d6660a9bc148i0”,“output_id”:“55f5b874ba69984bo0”},{“input_id”:“55e481f58d950343i0”,“output_id”:“55e3d6660a9bc148o0”},{“input_id”:“55e481f58d950343i0”,“output_id”:“55e3d6660a9bc148o0”},{“input_id”:“55e4f37a5a060240i0”,“output_id”:“55e481f58d950343o0”},{“input_id”:“55e4f37a5a060240i0”,“output_id”:“55e481f58d950343o0”},{“input_id”:“55e52ad8c0eef649i0”,“output_id”:“55e4f37a5a060240o0”},{“input_id”:“55e52a0c31b4a447i0”,“output_id”:“55e4f37a5a060240o0”},{“input_id”:“55e52a0c31b4a447i0”,“output_id”:“55e4f37a5a060240o0”},{“input_id”:“55e63c5debc6f441i1”,“output_id”:“55e52a0c31b4a447o0”},{“input_id”:“55e52ad8c0eef649i0”,“output_id”:“55e4f37a5a060240o0”},{“input_id”:“55e63ec5c9a29b4ei1”,“output_id”:“55e52ad8c0eef649o0”},{“input_id”:“55e63c5debc6f441i1”,“output_id”:“55e52a0c31b4a447o0”},{“input_id”:“55ec3d1f30e9d44di1”,“output_id”:“55e63c5debc6f441o0”},{“input_id”:“55ec3c951a4a1248i2”,“output_id”:“55e63c5debc6f441o0”},{“input_id”:“55e63ec5c9a29b4ei1”,“output_id”:“55e52ad8c0eef649o0”},{“input_id”:“55ec3d1f30e9d44di2”,“output_id”:“55e63ec5c9a29b4eo0”},{“input_id”:“55ec3c951a4a1248i1”,“output_id”:“55e63ec5c9a29b4eo0”},{“input_id”:“55ec3c951a4a1248i0”,“output_id”:“55f3561e70647741o0”},{“input_id”:“55ec3c951a4a1248i1”,“output_id”:“55f3561e70647741o0”},{“input_id”:“55ec3c951a4a1248i1”,“output_id”:“55e63ec5c9a29b4eo0”},{“input_id”:“55ec3c951a4a1248i2”,“output_id”:“55e63c5debc6f441o0”},{“input_id”:“55ec3d1f30e9d44di0”,“output_id”:“55f356c931922d4co0”},{“input_id”:“55ec3d1f30e9d44di1”,“output_id”:“55f356c931922d4co0”},{“input_id”:“55ec3d1f30e9d44di1”,“output_id”:“55e63c5debc6f441o0”},{“input_id”:“55ec3d1f30e9d44di2”,“output_id”:“55e63ec5c9a29b4eo0”},{“input_id”:“55ec3c951a4a1248i0”,“output_id”:“55f3561e70647741o0”},{“input_id”:“55ec3c951a4a1248i1”,“output_id”:“55f3561e70647741o0”},{“input_id”:“55ec3d1f30e9d44di0”,“output_id”:“55f356c931922d4co0”},{“input_id”:“55ec3d1f30e9d44di1”,“output_id”:“55f356c931922d4co0”},{“input_id”:“55e3d6660a9bc148i0”,“output_id”:“55f5b874ba69984bo0”}]}}}

1 Like
Code for Spawning

{“data”:{“behavior”:{“v”:“2”,“nodes”:[{“inputCount”:2,“outputCount”:0,“name”:“Spawning”,“behaviorType”:“logic.NodeGroup”,“x”:180,“y”:-1280,“group”:"",“id”:“55ef7cae76b5e941”,“isMenuItem”:false},{“inputCount”:0,“outputCount”:1,“name”:“Bundle Input”,“behaviorType”:“logic.NodeGroupInput”,“x”:-630,“y”:-320,“group”:“55ef7cae76b5e941”,“id”:“55efc34323964348”,“portId”:“55ef7cae76b5e941i0”,“tag”:“Good”,“dataType”:2},{“inputCount”:0,“outputCount”:1,“name”:“Bundle Input”,“behaviorType”:“logic.NodeGroupInput”,“x”:-630,“y”:-160,“group”:“55ef7cae76b5e941”,“id”:“55efc3abf4404b44”,“portId”:“55ef7cae76b5e941i1”,“tag”:“Bad”,“dataType”:2},{“inputCount”:0,“outputCount”:1,“name”:“Collision”,“behaviorType”:“logic.triggers.Collision”,“x”:-630,“y”:-512,“group”:“55ef7cae76b5e941”,“id”:“55f06a695b9f6c47”,“targetClassId”:12197051,“targetEntityId”:0,“collisionFilter”:15,“collideWithEntity”:false,“delay”:0},{“inputCount”:3,“outputCount”:1,“name”:“Number”,“behaviorType”:“logic.logic.Value”,“x”:-270,“y”:-512,“group”:“55ef7cae76b5e941”,“id”:“55f086569c79c041”,“startVal”:0,“roundMode”:1},{“inputCount”:3,“outputCount”:1,“name”:“Number”,“behaviorType”:“logic.logic.Value”,“x”:-450,“y”:-512,“group”:“55ef7cae76b5e941”,“id”:“55f089049eeaa64a”,“startVal”:1,“tag”:"",“roundMode”:1},{“gateVal”:8,“mode”:“equal to”,“inputCount”:2,“outputCount”:2,“name”:“Filter”,“behaviorType”:“logic.logic.Filter”,“x”:-90,“y”:-512,“group”:“55ef7cae76b5e941”,“id”:“55f0c21e8d17764d”},{“inputCount”:3,“outputCount”:1,“name”:“Spawn”,“behaviorType”:“logic.components.Spawn2”,“x”:180,“y”:-512,“group”:“55ef7cae76b5e941”,“id”:“55f109c079f84c46”,“entityClassId”:12197235,“spawnX”:0,“spawnY”:0},{“inputCount”:1,“outputCount”:1,“name”:“Extractor”,“behaviorType”:“logic.properties.Extractor”,“x”:-90,“y”:-608,“group”:“55ef7cae76b5e941”,“id”:“55f109c1a911d94c”,“targetId”:0,“prop”:“y”},{“inputCount”:1,“outputCount”:1,“name”:“Extractor”,“behaviorType”:“logic.properties.Extractor”,“x”:-90,“y”:-704,“group”:“55ef7cae76b5e941”,“id”:“55f109c16fa48449”,“targetId”:0,“prop”:“x”},{“inputCount”:0,“outputCount”:1,“name”:“Always”,“behaviorType”:“logic.triggers.Always”,“x”:-270,“y”:-640,“group”:“55ef7cae76b5e941”,“id”:“55f17b4a1877e34a”},{“inputCount”:1,“outputCount”:0,“name”:“Message”,“behaviorType”:“logic.components.Message”,“x”:-270,“y”:-160,“group”:“55ef7cae76b5e941”,“id”:“55f1fee8f3481842”,“notes”:“Send to last contacted object”,“n_o”:1,“msg”:“bad traits”,“targetEntityId”:0,“targetClassId”:0,“sendToLastContacted”:true,“sendToEntity”:false,“sendToSelf”:false,“sendToAttached”:false,“sendReply”:false},{“inputCount”:1,“outputCount”:0,“name”:“Message”,“behaviorType”:“logic.components.Message”,“x”:-270,“y”:-320,“group”:“55ef7cae76b5e941”,“id”:“55f1ff5497155b45”,“notes”:“Send to last contacted object”,“n_o”:1,“msg”:“good traits”,“targetEntityId”:0,“targetClassId”:0,“sendToLastContacted”:true,“sendToEntity”:false,“sendToSelf”:false,“sendToAttached”:false,“sendReply”:false},{“inputCount”:3,“outputCount”:1,“name”:“Number”,“behaviorType”:“logic.logic.Value”,“x”:-450,“y”:-160,“group”:“55ef7cae76b5e941”,“id”:“55f2ce1a04769943”,“startVal”:0,“roundMode”:1},{“inputCount”:3,“outputCount”:1,“name”:“Number”,“behaviorType”:“logic.logic.Value”,“x”:-450,“y”:-320,“group”:“55ef7cae76b5e941”,“id”:“55f2ceb38ab68f49”,“startVal”:0,“roundMode”:1}],“links”:[{“input_id”:“55f2ceb38ab68f49i0”,“output_id”:“55efc34323964348o0”},{“input_id”:“55f2ce1a04769943i0”,“output_id”:“55efc3abf4404b44o0”},{“input_id”:“55f089049eeaa64ai1”,“output_id”:“55f06a695b9f6c47o0”},{“input_id”:“55f0c21e8d17764di0”,“output_id”:“55f086569c79c041o0”},{“input_id”:“55f086569c79c041i2”,“output_id”:“55f089049eeaa64ao0”},{“input_id”:“55f109c079f84c46i2”,“output_id”:“55f0c21e8d17764do0”},{“input_id”:“55f2ceb38ab68f49i1”,“output_id”:“55f109c079f84c46o0”},{“input_id”:“55f2ce1a04769943i1”,“output_id”:“55f109c079f84c46o0”},{“input_id”:“55f109c079f84c46i1”,“output_id”:“55f109c1a911d94co0”},{“input_id”:“55f109c079f84c46i0”,“output_id”:“55f109c16fa48449o0”},{“input_id”:“55f109c16fa48449i0”,“output_id”:“55f17b4a1877e34ao0”},{“input_id”:“55f109c1a911d94ci0”,“output_id”:“55f17b4a1877e34ao0”},{“input_id”:“55f1fee8f3481842i0”,“output_id”:“55f2ce1a04769943o0”},{“input_id”:“55f1ff5497155b45i0”,“output_id”:“55f2ceb38ab68f49o0”}]}}}

Code for being killed

{“data”:{“behavior”:{“v”:“2”,“nodes”:[{“inputCount”:2,“outputCount”:0,“name”:“Die Off”,“behaviorType”:“logic.NodeGroup”,“x”:180,“y”:-1152,“group”:"",“id”:“55f64ae4ced4d348”,“isMenuItem”:false},{“inputCount”:0,“outputCount”:1,“name”:“Bundle Input”,“behaviorType”:“logic.NodeGroupInput”,“x”:-360,“y”:-256,“group”:“55f64ae4ced4d348”,“id”:“55f66e2e6e646145”,“portId”:“55f64ae4ced4d348i0”,“tag”:“Good”,“dataType”:2},{“inputCount”:0,“outputCount”:1,“name”:“Bundle Input”,“behaviorType”:“logic.NodeGroupInput”,“x”:-360,“y”:-160,“group”:“55f64ae4ced4d348”,“id”:“55f66ea0bcfa774f”,“portId”:“55f64ae4ced4d348i1”,“tag”:“Bad”,“dataType”:2},{“gateVal”:0,“mode”:“less than or equal to”,“inputCount”:2,“outputCount”:2,“name”:“Filter”,“behaviorType”:“logic.logic.Filter”,“x”:-90,“y”:-256,“group”:“55f64ae4ced4d348”,“id”:“55f6fbc8d4db9546”,“notes”:“On/Off Switch can be used so they have the possability to die only once”,“n_o”:1},{“expression”:“B-A”,“default0”:0,“default1”:0,“default2”:0,“default3”:0,“default4”:0,“default5”:0,“params”:2,“version”:2,“tag”:"",“inputCount”:3,“outputCount”:1,“name”:“Expression”,“behaviorType”:“logic.logic.Expression”,“x”:90,“y”:-128,“group”:“55f64ae4ced4d348”,“id”:“55f7c29a54ea3849”},{“inputCount”:3,“outputCount”:1,“name”:“Random”,“behaviorType”:“logic.logic.Random”,“x”:270,“y”:-192,“group”:“55f64ae4ced4d348”,“id”:“55fa3df66f5a264e”,“min”:0,“max”:100},{“gateVal”:0,“mode”:“less than or equal to”,“inputCount”:2,“outputCount”:2,“name”:“Filter”,“behaviorType”:“logic.logic.Filter”,“x”:360,“y”:-32,“group”:“55f64ae4ced4d348”,“id”:“55fb3dc6b7ebe34d”},{“inputCount”:1,“outputCount”:1,“name”:“Destroyer”,“behaviorType”:“logic.components.Destroyer”,“x”:540,“y”:-32,“group”:“55f64ae4ced4d348”,“id”:“55fbea2c42db7343”}],“links”:[{“input_id”:“55f6fbc8d4db9546i0”,“output_id”:“55f66e2e6e646145o0”},{“input_id”:“55f7c29a54ea3849i0”,“output_id”:“55f66e2e6e646145o0”},{“input_id”:“55f6fbc8d4db9546i1”,“output_id”:“55f66ea0bcfa774fo0”},{“input_id”:“55f7c29a54ea3849i1”,“output_id”:“55f66ea0bcfa774fo0”},{“input_id”:“55f7c29a54ea3849i2”,“output_id”:“55f6fbc8d4db9546o0”},{“input_id”:“55fa3df66f5a264ei0”,“output_id”:“55f7c29a54ea3849o0”},{“input_id”:“55fb3dc6b7ebe34di1”,“output_id”:“55f7c29a54ea3849o0”},{“input_id”:“55fb3dc6b7ebe34di0”,“output_id”:“55fa3df66f5a264eo0”},{“input_id”:“55fbea2c42db7343i0”,“output_id”:“55fb3dc6b7ebe34do0”}]}}}

For 5% you can also do 1-20, equal to any number in between 1-20.

If anything is unclear or something doesn’t work just ask and I’ll try to help. I made this in a few minutes and haven’t tested it so there’s a good chance something is slightly incorrect with it.
@theglitch055

1 Like

is this what you’re looking for? or are you asking for something else?

1 Like

For example, lets say a herbivore can only see red (the color of plants) and brown things (the color of their fur), all the plants are red so they have no problem locating them and getting food. One is born with a slight difference in its genome that allows it to see purple in conjunction with red and brown, this herbivore would now be able to locate and eat purple plants. this means they have an easier time getting food and means they have a higher chance of surviving long enough to mate and have children, these children are likely to have inhereted their parents ability to see purple through genetics. As a result more and more of the population begins to see purple and locate purple plants growing the population. this would be a positive change. An example for a negative change would be the herbivore being born only being able to see brown, they would only be able to see themselves and others of there kind and would probably starve to death.

1 Like

The first 8 minutes of this explains it pretty well, basically im trying to figure out the best way to read the traits and other data (such as the collision data) and read it to replicate the same effects to another organism.

1 Like

Kk, I’ll work on it when I get the chance. I should be able to make this happen.

1 Like

Ok

1 Like

That should code the genome.
If this doesn’t work tell me and I’ll modify it. If you need me to explain how to add more/how it works just ask and I’ll help.

Coding the genome

1 Like

If you need me to help with the dying off or something else I’m happy to help, this seems like a really cool project.

1 Like

So you want mutations and trait inheriting? Not very hard, for things you cannot combine pick a random one from the parent and also make mutations randomly pick a trait to alter.

1 Like

Alright I’ve pretty much got everything figured out, however the current aging system implemented is terrible, the population in an ideal scenario can go from 50 to somewhere around 764 in just a couple minutes (Id say 10 max) Any ideas?

Make eggs that take time to hatch, add a mating cooldown, also add natural death and death of old aging

Increase the number of mutations so it’s more likely for some to die, or increase the number of food they need to collect to before spawning another one.

Alright so here’s a conceptual way this would work

---- Eggs require 6 bits to lay, organisms that don’t use eggs have to eat 1-2 extra bits every time they reproduce

---- Organisms with the toxic trait have 50 percent chance to die every second after reproducing 6 times

---- Vulnerable eggs

---- Reproduction cap (8)

---- Winter occurs every 3 minutes and last 5, during winter, food spawn is halfed, Winter alternates between the right side of the map and the left side every time it occurs

2 Likes

Wait, wdym by 6 bits?

1 Like

I think he’s using bits to refer to food, but maybe it’s something in their “genome,” idk.

1 Like

Im referring to food

1 Like