Welcome To Darwinbots > Newbie

Best thing ever

<< < (8/10) > >>

Tilthanseco:

--- Quote ---
--- Code: ---'Turn around
cond
 *.eye5 0 =
 *.in1 *971 sub abs 1 <
start
 314 rnd .aimdx store
stop
--- End code ---

--- End quote ---
I would change the eye5 0 = to 0 >
and the  abs 1 < to  abs 1 =

That way its when it sees a conspec and includes 1 difference. With those changes the bots don't sit and stare.

Also, the sperm shooter works with what you have.

The generation protection strength was fixed with the code generator for me.

It's funny that this bot is getting such sophisticated cannibalism and sex genes when it doesn't even know how to aim. ("*.refxpos *.refypos angle .setaim store" would work)
Although adding aiming would greatly increase the number of deaths by cannibalism...

southpointingchariot:

--- Quote from: Tilthanseco on July 03, 2012, 12:01:53 AM ---
--- Quote ---
--- Code: ---'Turn around
cond
 *.eye5 0 =
 *.in1 *971 sub abs 1 <
start
 314 rnd .aimdx store
stop
--- End code ---

--- End quote ---
I would change the eye5 0 = to 0 >
and the  abs 1 < to  abs 1 =

That way its when it sees a conspec and includes 1 difference. With those changes the bots don't sit and stare.

Also, the sperm shooter works with what you have.

The generation protection strength was fixed with the code generator for me.

It's funny that this bot is getting such sophisticated cannibalism and sex genes when it doesn't even know how to aim. ("*.refxpos *.refypos angle .setaim store" would work)
Although adding aiming would greatly increase the number of deaths by cannibalism...

--- End quote ---

This is very strange - making the changes I think you're suggesting, the bots just stare at eachother. 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 ---

I'm certainly open to suggestions for other things - I don't really understand a lot (obviously), and my goal is to get the basics of reproduction and generation control working and then start evo-simming and making small changes as I understand things. If you want to suggest any coding layout, I certainly wouldn't complain (it might help me stop coming back over and over again if there was a way to have each bit of code explained how it actually works, as I don't really understand what's happening for much of it - but I'm guessing there isn't a "stack to english" translator program out there ;) . I'm still not totally sure what "*" means). 

Is there any way to utilize the type of methodology I outlined in my earlier post? I could write in javascript, but feel quite lost here.

Tilthanseco:
It's ok, I like helping.

I found the new problem, 971 wasn't increasing with each generation. That should fix it.

--- Code: ---cond
*.robage 1 =
start
971 inc
stop
--- End code ---
I didn't even see this...

--- Quote from: southpointingchariot on July 02, 2012, 09:55:15 PM ---
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

--- End quote ---
A. Could just have it store a random number in a memory location, 50-150 are the safest "free" memory locations. So just 9999 rnd 50 store
B. Give the child the number so put a number in 971 - 990, 9999 rnd 973 store.
C. Have the parent post its A in another hand-me-down like 974. Or in out3
D. I have no clue how to implement arrays in dna.  :blink: Could just have the offspring code be in a fixed range. Like +- 100 from parent ID.
I think what you have going on now would be far less complicated, we already have it coded anyways...

On a whole different topic... (Tutorial Mode) you can ask me what ever questions you have. Sorry if I confuse you.

--- Code: ---'You can define custom names for memory locations and you can make constants.
' Just put def followed by a name then memory number to name a location
def count 51
' That names the memory location 51, count
def age 100
' Here I set the constant "age" to 100
' Use custom names like any other sysvar, *.variable .variable
' Only refer to constants by .constant (else you'll get errors with *.constant)
' Example
cond
' When bot age is greater than the constant age(100) (use .age to refer to the 100)
' (*.robage 100 >)
*.robage .age >
start
' Look at the variable count(51) add 3, then store that back into count(51)
' (*51 3 add 51 store)
*.count 3 add .count store
stop
--- End code ---

To help with debugging, you can click on a bot and open up it's console, here you can see what genes activate, set the energy, and look at the eyes.
You can also look at the bot's memory by opening the info panel and pressing memory, and looking over the dna in the dna panel will show you if you make a typo by usually saying "0" instead of ".aimdx" ect. You can also move bots around in the sim window.

For coding, I have found that looking at other non-complex and preferably commented bot code helps. Also, commenting someone else's bot dna is a good way to see how things work.
Try figuring out how "SexBot" by d-EVO works. http://forum.darwinbots.com/index.php/topic,3037.0.html

In bot dna, the bot's controls and senses are operated by referring to 1000 memory addresses. Storing a number in one makes the bot do something.
The * tells the dna what is currently in that memory address. The words on the sysvar page are just for us humans. Saying .up means use memory location 7.
Saying *.up says look at what is in memory location 7. That's why we use *.eye5, it says "what does eye 5 see" Which is technically "what's in memory location 505"

The stack is really crazy to me also. For some reason, numbers in dna get put in a pile that is worked on and stays there till the cycle ends.
"5 5 5 add store" would put three 5's on the stack, then add the last two numbers on the stack (the second and third 5), then store the first number on the stack (the first 5) in the result of 10. It's the same as:
5 10 store

The stack is not confined to just one gene or action either.

--- Code: ---cond
*.eye1 *.eye9 >
start
mult -145
stop

cond
*.eye9 *.eye1 >
start
mult 145
stop

cond
start
.aimdx store
stop
--- End code ---
This code will get rid of previous stuff on the stack with "mult" (I don't know how...) and then place a number. The last gene will use the last number placed and store it in .aimdx.

I would not worry about figuring out how condition-less or single store bots work until you get a feel for the simple stuff.

Condition-less (Less Boo!!) (I made This  :))

--- Code: ---cond
start
' Ident
123 .out1 store

'Move
2 .up
*.eye5 0 sub sgn abs 1 sub -
*.out1 *.in1 sub sgn abs 1 sub -
add sgn abs mult
store

'See
-140 .aimdx
*.eye1 *.eye9 sub sgn 0 floor mult
store

140 .aimdx
*.eye9 *.eye1 sub sgn 0 floor mult
store

-15 .aimdx
*.eye4 *.eye6 sub sgn 0 floor mult
store

15 .aimdx
*.eye6 *.eye4 sub sgn 0 floor mult
store

' Follow
*.refvelup 20 add .up
*.eye5 0 sub sgn 0 floor mult
*.out1 *.in1 sub sgn abs mult
store
*.refveldx .dx
*.eye5 0 sub sgn 0 floor mult
*.out1 *.in1 sub sgn abs mult
store

'Shoot
-1 .shoot
*.eye5 40 sub sgn 0 floor mult
*.out1 *.in1 sub sgn abs mult
store
*.refvelup .up
*.eye5 40 sub sgn 0 floor mult
*.out1 *.in1 sub sgn abs mult
store
0 .aimdx
*.eye5 40 sub sgn 0 floor mult
*.out1 *.in1 sub sgn abs mult
store

'Conspec
*.refaim .setaim
*.out1 *.in1 sub sgn abs 1 sub - mult
store

'Repro
30 .repro
*.nrg 10000 sub sgn 0 floor mult
store
stop
end
--- End code ---

Single Store (Boo!!) Viewer's Discretion is Advised!

--- Quote from: happyhamsterchan ---
--- Code: --- start
 *.tiepres *.numties sgn mult 100 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor -- abs mult add 628 rnd *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor *.eye5 30 sub sgn 0 floor mult *.eye5 sgn *.myeye *.refeye sub sgn abs -- abs mult add sgn mult add 40 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor mult *.eye5 30 sub sgn 0 floor -- abs mult add -6 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub abs 0 floor -- abs mult *.myeye *.refeye sub sgn abs mult *.eye5 40 sub sgn 0 floor mult add -60 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor -- abs mult *.eye5 sgn -- abs mult *.eye9 sgn mult add 40 *.vel sub *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor -- abs mult *.eye5 sgn -- abs mult *.eye9 sgn -- abs mult add 50 *.eye5 sub 0 floor over *.vel sub *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor -- abs mult *.myeye *.refeye sub sgn abs mult *.eye5 sgn abs mult *.eye5 40 sub sgn 0 floor -- abs mult add 467 *.numties sgn mult 313 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor -- abs mult add 5 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor *.eye5 30 sub sgn 0 floor mult *.eye5 sgn *.myeye *.refeye sub sgn abs -- abs mult add sgn mult add 300 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor mult *.eye5 30 sub sgn 0 floor -- abs mult add 7 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor -- abs mult *.myeye *.refeye sub sgn abs mult *.eye5 40 sub sgn 0 floor mult add 6 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor -- abs mult *.eye5 sgn -- abs mult *.eye9 sgn mult add 1 *.numties sgn -- abs mult *.body 50 sub sgn 0 floor mult *.nrg 2000 sub sgn 0 floor -- abs mult *.eye5 sgn -- abs *.eye9 sgn -- abs mult *.myeye *.refeye sub sgn abs *.eye5 sgn abs mult *.eye5 40 sub sgn 0 floor -- abs mult add sgn mult add store
 stop
--- End code ---

--- End quote ---
:puke:

southpointingchariot:

--- Quote from: Tilthanseco on July 03, 2012, 02:34:18 AM ---I found the new problem, 971 wasn't increasing with each generation. That should fix it.

--- Code: ---cond
*.robage 1 =
start
971 inc
stop
--- End code ---

--- End quote ---
That seems to be working somewhat better - bots still sometimes stare at each other until something runs by them. Exactly who will the bots not  attack in this system? Is it everyone of the same age?


--- Quote ---I think what you have going on now would be far less complicated, we already have it coded anyways...
--- End quote ---
Gotya, that makes sense. I'm just trying to make sure there's sufficient cannibalism, without bots just circling around their immediate children. The goal is cross-pollinated violence ;). This is key to my system (I don't insert veggies when their population is low, they and the taxxons have to find a sustainable level). The real goal is an evo-sim that's as full featured and realistic as possible, while keeping population totals low enough to minimize slow down.

One interesting thing I've noticed is that perhaps the most effective mutation is bots lying about whether they've been fertilized. This makes other bots think they're not fertile, and sperm them over and over while they're being eaten. I've also had a case where a taxxon mutated to the point where it would fertilize a rolling moss, and the moss mutated where it woudl sexrepro, thus creating a carnivorous mobile veggy! Or maybe they just spermed them by accident?


--- Quote ---On a whole different topic... (Tutorial Mode) you can ask me what ever questions you have.
--- End quote ---
Yay tutorial mode


--- Quote ---
--- Code: ---'You can define custom names for memory locations and you can make constants.
' Just put def followed by a name then memory number to name a location
def count 51
' That names the memory location 51, count
def age 100
' Here I set the constant "age" to 100
[/quote]
Are constants stored in memory somewhere or are they just nice and free?

[quote]
' Example
cond
' When bot age is greater than the constant age(100) (use .age to refer to the 100)
' (*.robage 100 >)
*.robage .age >
start
' Look at the variable count(51) add 3, then store that back into count(51)
' (*51 3 add 51 store)
*.count 3 add .count store
stop
--- End code ---

--- End quote ---
So this means after 100 cycles from the bot's birth, every cycle, add 3 to count?

--- Quote ---To help with debugging, you can click on a bot and open up it's console, here you can see what genes activate, set the energy, and look at the eyes.
You can also look at the bot's memory by opening the info panel and pressing memory, and looking over the dna in the dna panel will show you if you make a typo by usually saying "0" instead of ".aimdx" ect. You can also move bots around in the sim window.

--- End quote ---
I hadn't looked at the console - this means its good to spread out your dna across genes so you can see what happens when right?


--- Quote ---For coding, I have found that looking at other non-complex and preferably commented bot code helps. Also, commenting someone else's bot dna is a good way to see how things work.
Try figuring out how "SexBot" by d-EVO works. http://forum.darwinbots.com/index.php/topic,3037.0.html
--- End quote ---
Thanks for the tip - I'm trying to find understandable bots. I'll look over that in detail at some point, looks actually comprehensible, and gives me a good reason to look up sysvars :). Right now I'm confused with
--- Code: ---cond
 *.x 1 =
 *.eye5 0 >
 *.in1 1 =
start
 *.refveldx .dx store
 *.eye5 50 =>
 *.refvelup .up store
 -6 .shoot store
 dropbool
 *.eye5 50 <
 *.refvelup 30 add .up store
 dropbool
stop
--- End code ---
Is this like gifting some body to another female?


--- Quote ---In bot dna, the bot's controls and senses are operated by referring to 1000 memory addresses. Storing a number in one makes the bot do something.
The * tells the dna what is currently in that memory address. The words on the sysvar page are just for us humans. Saying .up means use memory location 7.
Saying *.up says look at what is in memory location 7. That's why we use *.eye5, it says "what does eye 5 see" Which is technically "what's in memory location 505"
--- End quote ---
Ahhhh, thank you so much.


--- Quote ---The stack is really crazy to me also. For some reason, numbers in dna get put in a pile that is worked on and stays there till the cycle ends.
"5 5 5 add store" would put three 5's on the stack, then add the last two numbers on the stack (the second and third 5), then store the first number on the stack (the first 5) in the result of 10. It's the same as:
5 10 store

The stack is not confined to just one gene or action either.

--- Code: ---cond
*.eye1 *.eye9 >
start
mult -145
stop

cond
*.eye9 *.eye1 >
start
mult 145
stop

cond
start
.aimdx store
stop
--- End code ---
This code will get rid of previous stuff on the stack with "mult" (I don't know how...) and then place a number. The last gene will use the last number placed and store it in .aimdx.
--- End quote ---
I wonder if I should find a tutorial for FORTH or some other stack language.

Thank you so much, please keep the advice coming! I need all the instruction I can find, and I'm working on finding the next thing to improve. I think I'd like to get bots to better handle objects - they seem to just look at them and stand still indefinitely, adding unnecessary population and not eating or hunting anything.

Tilthanseco:

--- Quote --- I think I'd like to get bots to better handle objects
--- End quote ---
Ya, in evo sims I like to put an object in hoping they will eventually figure out what to do with it.
In some of my sims, the object would move, grouping veggies in a pile, then the bots would plow through them, eating all they could get.

If you want them aware of objects, .refnrg can be used (objects and corpses have no energy), or .reftype (0 for bots, 1 for objects)


--- Quote ---bots still sometimes stare at each other until something runs by them. Exactly who will the bots not  attack in this system? Is it everyone of the same age?
--- End quote ---
If you have mutations on, the cannibalism code may be breaking. Like I said in the beginning this is simple and would probably last a long time, though they would eat each other when they were old enough.

--- Code: ---cond
start
*.robage 100 <
-20 .up store
0 .shoot store
dropbool
'This drops the last condition in the gene, I didn't feel like making two genes, so here is one with two conditions
*.refage 100 < *.eye5 0 > and
0 .shoot store
314 .aimdx store
stop
--- End code ---
or

--- Code: ---cond
*.robage 100 <
start
-20 .up store
0 .shoot store
stop

cond
*.refage 100 <
*.eye5 0 >
start
0 .shoot store
314 .aimdx store
stop
--- End code ---


--- Quote ---So this means after 100 cycles from the bot's birth, every cycle, add 3 to count?
--- End quote ---
Yep. (idk why I called it count...)

--- Quote ---this means its good to spread out your dna across genes so you can see what happens when right?
--- End quote ---
Yep, when I make any bots, the best way to see if it is working right is to look at how the genes turn on and work together, a even better way to see gene activations is to click "show activations" in the info panel, that keeps a small visual history of the genes.


--- Quote ---
--- Code: ---start
 *.refveldx .dx store
 *.eye5 50 =>
 *.refvelup .up store
 -6 .shoot store
 dropbool
 *.eye5 50 <
 *.refvelup 30 add .up store
 dropbool
stop
--- End code ---

Is this like gifting some body to another female?
--- End quote ---
No, that is a generic attack gene using inline conditions, the -6 .shoot is a different shot type. -1 makes the attacked bot give mainly nrg back from it's nrg pool, -6 makes the attacked bot give mainly nrg back from it's body pool.
The attacking bot gets 95% nrg, 4% body, and 1% waste from either method I remember.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version