Welcome To Darwinbots > Newbie
Best thing ever
southpointingchariot:
--- Quote from: Tilthanseco on July 02, 2012, 01:32:04 PM ---Have the shooting and following gene make sure that it's old enough. That would still let them attack each other in the future.
Maybe for not attack children and parents ever, have them pass down a code.
Have them make a code and put it in 971 (Racial memory)
--- Code: ---cond
*971 0 =
start
32000 rnd 971 store
stop
--- End code ---
Broadcast the code
--- Code: ---cond
*971 *.out1 !=
start
*971 .out1 store
stop
--- End code ---
Then have them check to see if others have that code and if they do, don't shoot or follow.
--- Code: ---cond
*.eye5 40 >
*.in1 *971 !=
start
'Shoot
stop
--- End code ---
That should keep them from killing their children and mom's.
You can probably also use memval and memloc, but I don't have experience with those.
--- End quote ---
Wow! Thank you! Testing it out, it seems that this causes the bots not to attack anyone with shared parentage, not just the last or next generation. This makes one "family" take over and stop cannibalizing. Any thoughts? Is there a way to say "971++?"
Tilthanseco:
Ya I figured.
You could have the code randomly change, that will have the families become a random size.
--- Code: ---cond
32000 rnd 1 =
start
32000 rnd 971 store
stop
--- End code ---
For a lower chance you could put this as the cond:
--- Code: ---cond
32000 rnd 10000 rnd mult 1 =
--- End code ---
That^ takes a random number and multiplies it by another random number and it has to equal one.
Another way might be to have 971 increase (or decrease (dec)) every generation, then if 971 is too high its treated as an enemy.
--- Code: ---cond
*.robage 1 =
start
971 inc
stop
--- End code ---
Take the difference then the absolute value to see if it's close to the family number.
--- Code: ---cond
*.in1 *971 sub abs 2 >
start
'Shoot
stop
--- End code ---
See if that works. For the second option, the 2 controls how many generations are friends. I think 2 would be grand, parent, and child.
Also, if you have the number increase every generation there is a small chance it will reach the limit of 32000 so either make the code with a smaller number i.e. 10000 rnd.
Or make it negative i.e. 32000 rnd - 971 store ( "123 -" makes it -123)
southpointingchariot:
--- Quote from: Tilthanseco on July 02, 2012, 03:29:53 PM ---Ya I figured.
You could have the code randomly change, that will have the families become a random size.
--- Code: ---cond
32000 rnd 1 =
start
32000 rnd 971 store
stop
--- End code ---
For a lower chance you could put this as the cond:
--- Code: ---cond
32000 rnd 10000 rnd mult 1 =
--- End code ---
That^ takes a random number and multiplies it by another random number and it has to equal one.
Another way might be to have 971 increase (or decrease (dec)) every generation, then if 971 is too high its treated as an enemy.
--- Code: ---cond
*.robage 1 =
start
971 inc
stop
--- End code ---
Take the difference then the absolute value to see if it's close to the family number.
--- Code: ---cond
*.in1 *971 sub abs 2 >
start
'Shoot
stop
--- End code ---
See if that works. For the second option, the 2 controls how many generations are friends. I think 2 would be grand, parent, and child.
Also, if you have the number increase every generation there is a small chance it will reach the limit of 32000 so either make the code with a smaller number i.e. 10000 rnd.
Or make it negative i.e. 32000 rnd - 971 store ( "123 -" makes it -123)
--- End quote ---
Your second option sounds perfect - now I just have to figure out how to attach it my code ;). Here's what I have:
--- Code: ---'Taxxon
'By: southpointingchariot
'Eat each other, yo.
' Gene 1 Food Finder
cond
*.eye5 -10 >
start
*.refveldx .dx store
*.refvelup 30 add .up store
stop
' Gene 2 Eat Food
cond
*.eye5 50 >
*.in1 *971 sub abs 2 >
start
-1 .shoot store
*.refvelup .up store
stop
' Gene 3 Avoiding Family
cond
*.eye5 50 >
*.in1 *971 sub abs 2 <
start
314 rnd .aimright store
stop
'Am I Fertilized
cond
*.fertilized 0 >
start
' Display my fertilize status
*.fertilized .out2 store
stop
'Sperm shooter
cond
*.eye5 50 >
*.refeye *.myeye =
*.in1 *971 sub abs 2 >
start
-8 .shoot store
stop
'Sexual Reproduction
cond
*.fertilized 0 >
*.nrg 29999 >
start
50 .sexrepro store
stop
'Reproduction
cond
*.nrg 30000 >
start
50 .repro store
stop
cond
*.robage 1 =
start
971 inc
stop
'Here's who I am
cond
*971 *.out1 !=
start
*971 .out1 store
stop
--- End code ---
But unfortunately, it seems to lead to them not eating anything.
Tilthanseco:
First, I found that they start off thinking plants are friends because their 971 is only 1. I would add back in a code generator.
--- Code: ---cond
*971 0 =
start
10000 rnd 971 store
' 4 971 store
'or ^that^ if you want them not to eat each other in the beginning
stop
--- End code ---
Second, they don't kill each other because all they do is sperm each other to death. I would add a limiter on sperm, easyest to me is
--- Code: ---cond
*.eye5 50 >
*.refeye *.myeye =
*.in1 *971 sub abs 2 >
'Now it only shoots roughly every 25 shots
25 rnd 1 =
start
-8 .shoot store
stop
--- End code ---
Third, if you want them to sexrepro, I would space out the conditions, right now it says it needs 29,999 for sex and only 30,000 for repro. I tested it and they will randomly pick either one when it is fertilized. Which leaves a very unlikely chance of sexrepro. I would change it to 20 or 25 thousand.
southpointingchariot:
--- Quote from: Tilthanseco on July 02, 2012, 08:41:43 PM ---First, I found that they start off thinking plants are friends because their 971 is only 1. I would add back in a code generator.
--- Code: ---cond
*971 0 =
start
10000 rnd 971 store
' 4 971 store
'or ^that^ if you want them not to eat each other in the beginning
stop
--- End code ---
Second, they don't kill each other because all they do is sperm each other to death. I would add a limiter on sperm, easyest to me is
--- Code: ---cond
*.eye5 50 >
*.refeye *.myeye =
*.in1 *971 sub abs 2 >
'Now it only shoots roughly every 25 shots
25 rnd 1 =
start
-8 .shoot store
stop
--- End code ---
Third, if you want them to sexrepro, I would space out the conditions, right now it says it needs 29,999 for sex and only 30,000 for repro. I tested it and they will randomly pick either one when it is fertilized. Which leaves a very unlikely chance of sexrepro. I would change it to 20 or 25 thousand.
--- End quote ---
I think the problem is that a generational protection is to strong. I turned of the sperm shooter and they still were not attacking eachother enough. The goal was to make it so they only didn't attack their mother or child - it seems they aren't attacking anyone roughly their own age. I've cleaned things up a little - here's what I have:
--- Code: ---'Taxxon
'By: southpointingchariot
'Eat each other, yo.
'Hunting
'Food Finder
cond
*.eye5 -10 >
*.in1 *971 sub abs 1 >
start
*.refveldx .dx store
*.refvelup 30 add .up store
stop
'Eat Food
cond
*.eye5 50 >
*.in1 *971 sub abs 1 >
start
-1 .shoot store
*.refvelup .up store
stop
'Turn around
cond
*.eye5 0 =
*.in1 *971 sub abs 1 <
start
314 rnd .aimdx store
stop
'Generation
'Who Am I?
cond
*971 0 =
start
10000 rnd 971 store
stop
'Here's who I am
cond
*971 *.out1 !=
start
*971 .out1 store
stop
'Reproduction
'Am I Fertilized?
cond
*.fertilized 0 >
start
*.fertilized .out2 store
stop
'Sperm shooter
'cond
'*.eye5 50 >
'*.refeye *.myeye =
'*.in1 *971 sub abs 2 >
'*.in2 0 =
'start
'-8 .shoot store
'stop
'Sexual Reproduction
cond
*.fertilized 0 >
*.nrg 25000 >
start
50 .sexrepro store
stop
'Reproduction
cond
*.nrg 30000 >
start
50 .repro store
stop
--- End code ---
Here's one way I would do it it a much more more liberal system - not sure if it's possible here:
Each bot has 4 variables:
A. Personal identifier.
B. The identifier it will give to its next child.
C. The identifier it's parent had.
D. The "no shoot" array.
At Birth:
Add C to D
During Reproduction:
Add B to D
Tell new child to make A it's C
Randomly determine a new B
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version