Difference between revisions of "Talk:.edge"

From WikiManual
Jump to: navigation, search
m
m
Line 47: Line 47:
 
:ok. i don't get what you are doing here ...
 
:ok. i don't get what you are doing here ...
 
:what are the '''5''' and '''1''' and extra '''rnd''' doing?
 
:what are the '''5''' and '''1''' and extra '''rnd''' doing?
:did you mean '''0.5'''? i don't see how you get a value in the range
+
:did you mean '''0.5'''? or perhaps '''-0.5'''?
:of -157 to _157 from this ... which is what i am looking for.
+
:i don't see how you get a value in the range of -157 to _157 from this ...  
 +
:which is what i am looking for.
 
:i'm thinking how i would do it with other programming ...
 
:i'm thinking how i would do it with other programming ...
 
:ie ... x=int(rnd(seed)*315-157) to give me an integer result between -157 and +157.
 
:ie ... x=int(rnd(seed)*315-157) to give me an integer result between -157 and +157.
 
:if your above is doing that, i don't see it ...
 
:if your above is doing that, i don't see it ...
 
:as i haven't yet figured out how all these commands/programming work.
 
:as i haven't yet figured out how all these commands/programming work.
:that's what i'm trying to learn, and why i am asking.
+
:that's what i'm trying to learn, and why i am asking those who do know.
 
:mow i can see how using only one '''store''' would use less energy ...
 
:mow i can see how using only one '''store''' would use less energy ...
 
:and that is what i am looking for ... the most efficient way to do this ...
 
:and that is what i am looking for ... the most efficient way to do this ...
Line 61: Line 62:
 
Not really sure why you'd want to though. The turning CW and then CCW would likely be inefficent, one rotation largely canceling out another.
 
Not really sure why you'd want to though. The turning CW and then CCW would likely be inefficent, one rotation largely canceling out another.
 
<font color="#009900">
 
<font color="#009900">
:i am not looking to have it turn CW and then CCW ...
+
:i am not looking to have it turn CW and '''then''' CCW ...
 
:but to have it randomly turn somewhere '''between''' 45 degrees CW and 45 degrees CCW.
 
:but to have it randomly turn somewhere '''between''' 45 degrees CW and 45 degrees CCW.
:i'm looking for letting a bot go where it needs to ...
+
:letting a bot go where it needs to without imposing either a CW or CCW  
:not imposing either a CW or CCW rotation on it ...
+
:rotation on it but allowing it to do either.
:IF that is what one wishes to. and i do. ;)
 
:all i am talking about is not confining the rotation to be CW '''OR''' CCW ...
 
:but allowing it to do either.
 
 
:iow ... coming straight on to an '''edge''' ...
 
:iow ... coming straight on to an '''edge''' ...
 
:to allow the bot to rnd rotate either left or right ... -45 to +45 degrees ...
 
:to allow the bot to rnd rotate either left or right ... -45 to +45 degrees ...
:not forcing it to do one or the other.
+
: or whatever range ... not forcing it one direction or the other.
:all i'm looking for is the most efficeint way to have the rnd be
+
:what i'm looking for is the most efficeint way to have the rnd change be
:from -45 to +45 degrees (-157 to +157) from the current heading ...
+
:-45 to +45 degrees (-157 to +157) from the current heading. {{User:Griz/sig}}
:rather than a random 0-90 degrees left '''OR''' 0-90 degrees right.{{User:Griz/sig}}
 
 
</font>
 
</font>
 
You'll have to ask Nums about the vector addition, not my strong suit I'm afraid.
 
You'll have to ask Nums about the vector addition, not my strong suit I'm afraid.

Revision as of 13:30, 26 December 2005

Example:

'this will turn a bot a random number of degrees upon hitting an edge.
314 rnd .aimdx *.edge mult store

This will turn the bot by a rnd amount between 0 an 90 degrees ... clockwise, yes?
and 314 rnd .aimsx *.edge mult store, 0-90 degress CCW?

If one wished to have the bot turn either CW or CCW ...
what would be the best way to do so?
will this work?:

628 rnd .aimdx *.edge mult store
-314 .aimdx store

resulting in the bot rotating 0-90 degress to the left or right?

or:

314 rnd .aimdx *.edge mult store
-314 rnd .aimdx *.edge mult store

or:

314 rnd .aimdx *.edge mult store
314 rnd .aimsx *.edge mult store

resulting in smaller values near 0 degrees being more probable,
ie ... the distribution being more closely centered around zero?
Assuming any of the above would work ...
Which of these would be more costly for the bot?

Also ... perhaps the above is moot, eh?
How much of this is taken care of by the new physics of 2.4.X?
where the velocity and momentum is used to simply 'bounce' the bot
off of the 'edges'?
IOW ... do the physics take care of the bot's heading as part of
the bot's velocity vector, including the direction it is facing ...
or just it's delta x and delta y?
ie ... is it any longer necessary to rotate the bot?
[haven't had time to actually experiment and gather empirical data yet. i will.]
tanks.
Griztalk



If you're talking about rotating either left or right 90 random degrees upon sensing something, the best suggestion I could make would be to use something like:

' rotate either left or right 90 degrees upon hitting edge
314 rnd 5 *.edge mult 1 rnd add store

ok. i don't get what you are doing here ...
what are the 5 and 1 and extra rnd doing?
did you mean 0.5? or perhaps -0.5?
i don't see how you get a value in the range of -157 to _157 from this ...
which is what i am looking for.
i'm thinking how i would do it with other programming ...
ie ... x=int(rnd(seed)*315-157) to give me an integer result between -157 and +157.
if your above is doing that, i don't see it ...
as i haven't yet figured out how all these commands/programming work.
that's what i'm trying to learn, and why i am asking those who do know.
mow i can see how using only one store would use less energy ...
and that is what i am looking for ... the most efficient way to do this ...
but i don't see how your above results in a bot altering course by
the range of -45 to +45 degrees upon sensing an edge.

Not really sure why you'd want to though. The turning CW and then CCW would likely be inefficent, one rotation largely canceling out another.

i am not looking to have it turn CW and then CCW ...
but to have it randomly turn somewhere between 45 degrees CW and 45 degrees CCW.
letting a bot go where it needs to without imposing either a CW or CCW
rotation on it but allowing it to do either.
iow ... coming straight on to an edge ...
to allow the bot to rnd rotate either left or right ... -45 to +45 degrees ...
or whatever range ... not forcing it one direction or the other.
what i'm looking for is the most efficeint way to have the rnd change be
-45 to +45 degrees (-157 to +157) from the current heading. Griztalk

You'll have to ask Nums about the vector addition, not my strong suit I'm afraid. --Endychat 20:55, 25 Dec 2005 (MST)

The edges are set up to be springy, so as a result correct vector collision math will work. Note that it's not directly programmed in that way, but is mroe a natural consequence of how the forces interact. --Numsgil 01:01, 26 Dec 2005 (MST)

yes. understood as far as delta x and delta y goes.
and i like how the physics in 2.4.X works ... very realistic esp with some
gravity as a little rebound energy seems to be lost with each bounce ...
so a bot will eventually come to gradually settle on the bottom.
but my question is, does your physics reflect the bot's heading ...
ie ... does it rotate it, or just bounce the bot?
iow ... will a bot facing and moving straight ahead at say, 30 degrees
before encountering an edge ...
still be facing 30 degrees, and attempting to move in that direction
after the bounce?
i would think so but thought i would come to the source. ;)
still haven't had time to experiment ... maybe in the next day or two.
can you steer me towards an existing bot that just moves straight ahead
that i can then experiment with?
most of them are already spinning and i would like to see the effects of
just this edge turn gene at work.
i just haven't had a lot of time to study bot DNA and how the commands
work yet ... but all the stuff being added here at the wiki is great ...
so i'm trying to incorporate it into a bot so i can see first hand
the results. starting very, very simply ... nothing flash yet ...
just a simple bot moving one direction and figuring out to enable it
to rotate ... when/where/how/why and all that. thanks. Griztalk 10:23, 26 Dec 2005 (MST)