Darwinbots Forum

Bots and Simulations => DNA - General => Topic started by: Welwordion on May 17, 2006, 02:50:04 AM

Title: A problem with storing position as vector.
Post by: Welwordion on May 17, 2006, 02:50:04 AM
Ok as one of my projects involves the transformation of position into an vector so the information can be transferred vias tie, I wrote this little test genome.

Code: [Select]
cond
*.eye5 0 >
start
'the difference between positions of me and target
*.refxpos *.xpos sub
'I calculate if I have to divide trough 100 or 10 to scale it down to 3 digits or smaller and to be smaller than '320
*.refxpos *.xpos sub abs dup *.refypos *.ypos sub abs sub abs add *.refypos *.ypos sub abs add 2 div 100 div 31 sub sgn 1 add sgn 9 mult 1 add 10 mult div
'the first 3 digits are used
1000 mult
'the difference between positions of me and target
*.refypos *.ypos sub
'I calculate if I have to divide trough 100 or 10 to scale it down to 3 digits or smaller and to be smaller than '320
*.refxpos *.xpos sub abs dup *.refypos *.ypos sub abs sub abs add *.refypos *.ypos sub abs add 2 div 100 div 31 sub sgn 1 add sgn 9 mult 1 add 10 mult div
'store it in out1
add *.out1 store
'get the oinformation back from out1 and aim
*.out1 *.out1 1000 mod sub 1000 div *.xpos add *.out1 1000 mod *.ypos add
angle .setaim store
stop
end
Title: A problem with storing position as vector.
Post by: abyaly on May 19, 2006, 02:53:39 AM
add *.out1 store
should be
add .out1 store
Title: A problem with storing position as vector.
Post by: Welwordion on May 19, 2006, 09:55:55 AM
Hmm its seems that still not enough to make it work,also even when removing the scaling down calculations and operating only in small distances it turns strangely.
Maybe it aims before refreshing the refvariables? although that should not really matter that much.
really strange

Added:I am stupid, why I do not just use angle? its also an absolute value.
Title: A problem with storing position as vector.
Post by: PurpleYouko on May 20, 2006, 02:18:03 PM
Quote
Added:I am stupid, why I do not just use angle? its also an absolute value.

I did kind of wonder that