Bots and Simulations > DNA - General
Bots with Arrays
Prsn828:
I had a great idea this morning:
What if a bot used a chunk of memory and treated it like an array?
For the most part, I know it can work, but there is one problem; it wouldn't be able to use the whole array in one cycle.
I can't think of a single-cycle solution. Of course, if you define the upper and lower bounds of the array (which, coincidentally, allow it to be added to and expanded simply by incrementing the upper bound and storing the new data to the new upper bound) you can go through one or two values in the array each cycle, but without the ability to use a loop I don't think you can be certain you will look at the whole array every cycle.
I want to find a way around that problem, but I don't know what to do. Of course, if you could increase the number of genes in a bot every time the array size increased, then you could simply add a gene for each value in the array, but I don't think that is possible.
If there was a structure like the Codule that could be called by other genes, that would also work, but alas, that is a thing only found in DB3, which still is not up and running (But is still getting there).
Any ideas? If not, then this is one of DB2's bottle-necks, and would drastically hinder evolution in the program.
Numsgil:
Look into SG techniques. Depending on what you want to do with the data, you can just do 1000 iterations and use no-op techniques if the array is out of bounds.
Moonfisher:
Ehm... in a sence all the DB2 bot data is an array from 0 to 1000...
And evolution has no REAL botlenecks, and the things that slow down evolution are rarely the things we've noticed.
Evolution doesn't care about arrays, the sequence of it, or if it got the entire content of the array.
In fact nature couldn't care less, and the less precise the input is the more likely things are to work.
Even bugs in DB2 aren't a real problem for evolution, they may aswell be an advantage for all we know.
But for developping hand authored bots things are ofcourse different.
I haven't found any need for an array myself, but I think part of the reason is that all the memmory could be concieved as one big array.
For a hand authored bot I think going through a large array of data each cycle would slow down the sim speed for no good reason, and itterating through it for each cycles would take too long (Would probably require a rather large multicellular organism in a large sim in order for that to work)
But I think what I'm trying to get at is that DB has no loops ad probably shouldn't have them or it would allow programmers to create insanely slow bots.
And an array is realy no different from random data in memmory locations... Spinner uses an "array" of 5 different tie attack types and chooses one randomly from the array when attacking. (Just by chooseing a random offset to the first position of the "array")
So I guess what I'm saying is that arrays are already there in a way, it's the ability to itterate though the array that you're missing, and you can't make it since it would allow loops.
So if you have a lot of data you want to process every cycle, you'll have to manage without loops (Copy paste).
For readability I would personaly increment an offset in order to be able to use more or less the same line for each "itteration", so your code looks more like a loop wich has been unfolded.
But as mentioned, I realy don't think evolution cares, I'm pretty sure it'll access the data it needs directly, and if it needs all data every cycles it'll just access all data every cycle.
Moonfisher:
I was just sitting around thinking about the way dna works and how genes are defined with the whole cond, start, stop structure...
Was looking at zero bots and was noticing how an entire gene rarely had a condition, usualy the same things could be accomplished with inline conditions which seemed a lot easier for evolution to stumble uppon (Since it doesn't require a strict structure.)
Anyway got the idea that a gene wouldn't nessesarily have to be defined by such a structure, so here's my proposal for DB3 dna :
And bear with me, cause a lot of people may get stomach cramps and litle hairs raising on their neck when I say this but.... GOTO's !
And before you get into the whole loop's in dna area, I would sugest a limited use ofcourse.
I was thinking you should only be able to jump to positions that you have flagged in the code (This would make it easier for people to read the code)
And each flag should only be usable once per cycle... I'm not sure how noraml dna works, maybe it would be closer to reality if you could only jump forward.
Anyway, I know goto's are evil and all, but for dna I think it could actualy be usefull.
For viruses you could just use the flag to show which gene to charge as a virus (The gene being all code from the chosen flag untill the next flag), although I think it would be realy cool if viruses where buildt one bp at the time, so you would insert a new piece of the puzle for each cycle.
I know I heard someone mention self modifying code for DB3 which I think is an awesome idea, and I think this could actualy juice it up even more
I imaged it would work by having a new pointer type, which instead of pointing at a memmory location points at a position in the dna.
This would be usefull both for the self modifying code part (Especialy when us humans need to use it) and also for channeling viruses.
You could easily increment a pointer each cycle and add a piece of code, you can skip pieces and mix it up any way you like this way.
And viruses would be far more potent this way, a small piece of code can rearange your dna (Ofcourse you can always add a defence for this.)
Also this way a virus infection wouldn't change the amount of genes unless it contains a flag. I don't know if viruses IRL are actualy inserted as a gene or into a gene, if it has to be a gene the virus could just get a random flag.
Anyway the self modifying code part is also bound to make viruses and viral defences more interesting (Especialy if you have a pointer type for looking at specific bp)
Also if you want to go all out on jumps, you could just have a cap on how many bp can be rerun via a loop. A simple version of this could just be to add up the amount of bp jumped backwards (Jumping forward should be free I think), and if the jump you're trying to execute makes your total backwards line jumps in this cycle exceed the cap then you wouldn't be able to jump.
Personaly I prefer this idea actualy, now that I think about it... you could still allow the use of flags, but the point would be to make movement in the code more free and allow some loops with limited use per cycle. I think this would make the dna more powerfull, but I don't know if it's realistic to have loops in dna... would be very usefull though.
Prsn828:
Codules will basically facilitate this. They can be called from within other codules, so they can be called recursively to simulate a loop, or can be used like a goto.
Navigation
[0] Message Index
[#] Next page
Go to full version