Darwinbots Forum
Code center => Suggestions => Topic started by: Botsareus on February 21, 2005, 06:22:50 PM
-
Dim memory(1000) as Intager 'this actualy already Exists in the program
Do '<--- this loop is the robot stack loop itself
memory(0) = 0
Do
memory(memory(0) + 100) = 999 - memory(0)*2 '<--- inpossible in the current virsion
If memory(0) > 100 Then Exit Do
Loop
Loop
***Can you later add the ability for the DNA to store values in arrays , not in memory one by one
***And Robots will be able to mutate all this stuff naturaly
***THE ABOVE CODE WHEN WRITTEN IN DB DOES NOT USE ANY NEW LOOPS , IT CAN USE THE Cycling of the program itself as a loop. That makes even more sense because now a robot takes more time to store a bigger erray
-
ok I think what I am talking about is in the program already ex:
*.32 20 >
is a pointer from memory 32, is it greater then 20 ?
Therfore please include that it will mutate also; naturaly by the program: "Bots use there own memory to think , for once"
Am I correct some ? Am I wrong some ? , whats going on?
-
A quick note:
"*32", not "*.32"
-
ok I think what I am talking about is in the program already ex:
*.32 20 >
is a pointer from memory 32, is it greater then 20 ?
Therfore please include that it will mutate also; naturaly by the program: "Bots use there own memory to think , for once"
Am I correct some ? Am I wrong some ? , whats going on?
Yes it will mutate naturally by the program.
:D PY :D
-
OK MY FURTHER WORK/EXPERIMINTATION WITH ARRAYS/MATH :
cond
*20
0
=
start
20
21
store '21 is the pointer to memory location 20
1
22
store
22
23
store '23 is the pointer to memory location 22
stop
cond
start
20
inc
stop
cond
*20
100
>
start
0
*21
store
stop
end
PROBLEM :
WHEN I ADDED :
1
22
store
22
23
store '23 is the pointer to memory location 22
THIS STOPED WORKING :
20
inc
ANY ONE KNOW A SOLUTION?
-
I should of posted this in the bugs board , can any one help? , this is a real bug!
also will be nice if robots mutate stuff like :
*21
store
once thats possible , all erray monipulations are possible , but costly
-
First, I'd recommend using some labels, cause *21 makes peoples' heads hurt.
Secondly I'll give it a look.
-
Here's a labeled up version of what bots posted:
def a 20
def apoint 21
def c 22
def cpoint 23
cond
*.a 0 =
start
.a .apoint store store 'apoint points to a
1 .c store
.c .cpoint store 'cpoint points to c
stop
cond
start
.a inc
stop
cond
*.a 100 >
start
0 *.apoint store
stop
end
-
The problem is that robots will mutate the "unlabled-up" virson , so check that one as well , thanks in advance
Someone please ans:
*21 'can a pointer followed by a store mutate?
store
well can it?
-
Anything can mutate
The DNA is stored in two parts. The first thing that the program does is to de-tokenize the sysvars and make them into numbers.
The first part of the DNA array is "tipo" (Italian for type)
The second part is "value" (Italian for value :rolleyes: )
I can't be bothered to check the exact coding for this right now but it goes something like this.
*20 becomes DNA(n).tipo=1 and DNA(n).value=20
The type 1 indicates that this is a pointer to a memory address.
If you leave off the * then tipo wil be 0
if it was *. then the interpretter looks for an alpha-numeric sysvar and tipo becomes 2
When the robot mutates tipo and value are randomized for the particular line of DNA code so that any outcome is possible.
if tipo is 0 then the number after it is just a number.
if tipo is 1 then the number after it represents a pointer to a memory address
if tipo is 2 then the number after it is treated as a sysvar (if one exists for that number)
And so on
:D PY :D
-
Num what you gave me in the dna viewer looks like:
cond
*20
0
=
start
20
21
0 'notice all the extra zeros , thats another bug...
0
0
0
1
22
store
22
23
store
0
0
0
0
stop
-------------- 2
cond
start
20
inc
stop
-------------- 3
cond
*20
100
>
start
0
*21
store
stop
-------------- 4
end
and it does not reset after 100 back to 0
and without the "def" stuff it works completly different too ; try it without the def ,the way I wrote it, because: if this code ever will accure naturaly , thats the way it will accure: without the "def"s
P.S.
.a .apoint store store 'apoint points to a
was an error fixed by:
.a .apoint store 'apoint points to a
-
Oh, yeah, sometimes comments aren't commented out, I'm not sure why.
I'll fix it, hold on.
-
def a 20
def apoint 21
def c 22
def cpoint 23
cond
*.a 0 =
start
.a .apoint store store
'apoint points to a
1 .c store
.c .cpoint store
'cpoint points to c
stop
cond
start
.a inc
stop
cond
*.a 100 >
start
0 *.apoint store
stop
end
This works right.
-
and without the "def" stuff it works completly different too ; try it without the def ,the way I wrote it, because: if this code ever will accure naturaly , thats the way it will accure: without the "def"s
The problem is that robots will mutate the "unlabled-up" virson , so check that one as well , thanks in advance
Here it is again , stay with me here , :
cond
*20
0
=
start
20
21
store '21 is the pointer to memory location 20
1
22
store
22
23
store '23 is the pointer to memory location 22
stop
cond
start
20
inc
stop
cond
*20
100
>
start
0
*21
store
stop
end
one more thing:
.a .apoint store store 'apoint points to a
I know it works but why do you write store twice , whats the use of that?
-
If you're having trouble with that bot code, Bots, its 'cause the comments aren't commenting out.
Has anyone ever had success with in-line comments? It might be that they never worked, and we (atleast Bots and I) keep thinking they do.
The two stores you noticed is my brain collapsing. Pay no mind to the man behind the curtain. :rolleyes:
-
Has anyone ever had success with in-line comments? It might be that they never worked, and we (atleast Bots and I) keep thinking they do.
:unsure: ok
Now how about making in-line commands actualy work? so robots can (I am repeating again) "naturaly evolve them"
About time eh?
thanks for staying with me so far Num because next we will Tackle:
*20
*22
add
20
store
and while we will be at it will check sub and squrt and all the rest of them...
;)
-
I'll look at the parsing code for comments.
Note that you can't evolve comments, because comments are stripped from DNA when it's loaded into the program. Comments just help us humans handle abstract DNA code.
instead of:
*20
*22
add
20
store
you can use the wonderful new 'addstore' command.
Like this:
*22 20 addstore
I think.
-
NOOOOO! :o
Num is going to beat me to 100 posts :(
:ph43r: PY :ph43r:
-
NOOOOO! :o
Num is going to beat me to 100 posts :(
:ph43r: PY :ph43r:
Ah Crud. He just did.
:wacko: PY :wacko:
-
Bow before me, pawn!
Mwahahaha!
-
:huh: But please fix the inlines I was talking about please ;;
Are you saying robots can evolve "addstore" but cant evolve "add" "div"
This "addstore" in my opinion just makes everything more confusing
how about then we add
"divstore"
"substore"
"multstore"
"squrtstore" ' means a ^ b
??
or we just use good old "store" and add "squrt"
??
Ok I know its all confusing but hey I live for danger
:D Bau :D
I suggest evolve "add" and "sub" and "squrt" and the rest of it...
I suggest fix the program so my originaly posted dna works...
-
NO!!
Inline comments don't work!
They have to be at the start of a line.
Not sure why but they have never worked.
The two stores you noticed is my brain collapsing. Pay no mind to the man behind the curtain.
What that weird little man over there shouting into the megaphone and twiddling knobs and stuff?
:D PY :D
-
Have you checked out the DNA commands I added in 2.35?
Check the readme. They're all listed there.
When I said inline comments don't work, I mean inline comments don't work.
That is:
.a .b store 'blah blah comment
doesn't seem to work, but
.a .b store
'blah blah comment
does work.
The DNA all loads and runs correctly. The comments that are on the same line as DNA code seems to be loaded in as 0's.
-
And its sqr, not squrt.
-
Rofl ok I think PY and Num is completly confused , who is talking about "commants" here? I am talking about suggestions to fix the actual prossesing of the program
Some one read what we all wrote please
:(
OK OK its "sqr" not squrt" , how about we just replase it all with actual signs
+
-
*
/
^
good one ?
-
Bots, you said:
I suggest fix the program so my originaly posted dna works...
The reason your posted code didn't work is cause the comments were being parsed when they shouldn't
Just post your comments on spereate lines and they'll work.
-
Are you saying robots can evolve "addstore" but cant evolve "add" "div"
No he isn't saying that at all.
A robot can evolve [span style=\'font-size:14pt;line-height:100%\']ANY[/span] command at all. It will almost alway just appear as a number though.
Example:
A robot evolves a .mrepro command where .repro used to be.
Where previously it had been
50 .repro store
it will now be
50 301 store
Make sense?
All the mutation code does is to randomize a new number. ANY number. If the sysvar has a numeric equivalent then it CAN be mutated.
:D PY :D
-
sqr has no sign for it, except that funny radical symbol, so how can we use a symbol for it in the DNA?
the power function uses ^ though.
-
Thats how its called , its called the "power function" so we can use somthing like "pow" or just change everything into the actual symbols like:
+ - * / ^
anyway I am talking about stuff like:
add sub mult div pow
I WANT IT TO MUTATE IN THE PROGRAM , BUT I AM NOT SURE IF IT WORKS CORRECTLY YET BECAUSE EVEN:
cond
*20
0
=
start
20
21
store '21 is the pointer to memory location 20
store
1
22
store
22
23
store '23 is the pointer to memory location 22
stop
cond
start
20
inc
stop
cond
*20
100
>
start
0
*21
store
stop
end
NOTICE THIS IS THE VIRSION WITHOUT "DEF" BECAUSE THATS HOW IT WILL LOOK LIKE IF IT ACCURES NATURALY (MUTATES) WILL LOOK LIKE
DOES -*- NOT -*- WOOOOORK!!!!!!!!!
HEEEELLLLLPPPPP!!!!!!!
DONT REWRITE IT WITH DEFS AGAIN PLEASE!!!!!!!
THE VIRSION WITH "DEF" NUM GAVE ME WORKS GOOD , THATS NOT THE POINT
-
Alright Bots, listen very closely.
Remove the comments from your code. Put them on their own lines. Either way, pick one and do it. Your code will now work again.
In case there's confusion over what comments are, these are the comments in your code that are screwing it up:
'21 is the pointer to memory location 20
and
'23 is the pointer to memory location 22
-
OMFG ^%$^^%$
SORRY NUM I FORGOT THERE ARE STILL COMMENTS IN MY ORIGINAL CODE , Checking now...
LOL , YES IT WORKS MOVING ON TO USING +ADD+ , checking now...
IT WORKS , FINALY
TY TY TY
-
:D It's all good Bots, just making sure we're speaking the same language.
-
Just finished up coding the parser so that it will allow the following crazy coding styles:
cond 5 6 >
start 'do lotsa crazy stuff
5 6 store
stop
cond 'this is more normal
start
stop 'pretty cool huh?
end
-
rofl , Num whats the use of that?
-
It helps a lot!
Haven't you ever noticed that if you accidentally leave 2 spaces between stuff in a line of DNA code, it just gives a zero instead of the rest of the line?
Also this allows us to put comments directly after code in a line of DNA.
Sounds like a great idea to me.
:D PY :D
-
no its just
cond 'this is more normal
start
stop
confused me at first , its all empty
I gess thats what happens when a new gene is added to the Dna
-
If you noticed, Bots, I put comments after a line of commands as well. That's what your problem was before. I fixed it!
this is a coding style I could see happen:
cond
start
5 2 store 'explain this comment
5 8 mult 'explain this one too
6 5 add 'wow, and this one
div
stop
You can use spaces to help allign all the text.
-
:) THANKS NUM :)