Code center > Darwinbots3

Bot testbed

<< < (5/13) > >>

Numsgil:
Okay, fixed that render crash too.  New version is at the top of the thread.

Botsareus:
I like to simply point out that sin and cos use the full integer range in db2 because the result is multiplied by 32000. Therefore if you divide sin by cos you would get some decent but not perfect results.

Numsgil:
I'm not against changing the range, as long as it's a multiple of 360 (so the mapping to degrees is easy).  How do people feel about mapping [0, 360] degrees to [0, 9720], since the max range of memory is 9999?  I wouldn't want to go higher, even though the stack has 9 digits, since you couldn't store the result easily in memory.

Numsgil:
Oh, I've also uploaded a new version.  Change list and new binary at the top.

Shadowgod2:
i have me a crude swimmer :D finally..

--- Code: ---const seg 120
const maxh 20
const minh 5
const timer 10
'1 is always maxed
maxh 10 add .1

'wave up if count is 0 and prev seg is not 0ed

seg 2 div 1 add {
 dup 300 add ref sgn abs neg 1 add mul
 dup 1 sub ref minh sub sgn 1 sub sgn 1 add mul
 dup dup ref maxh swap sub 2 div swap ref add 1 add swap store } loop

'wave down if at or above max hight or -1 counter

seg 2 div 1 add {
 dup dup 300 add ref sgn 1 add sgn neg 1 add swap
 ref maxh sub sgn 1 add sgn add sgn mul
 dup dup dup ref swap ref  minh sub 2 div 1 add sub swap store
-1 swap 300 add store } loop

'count down from 3 to 0 when 0ed, 0 starts the wave, -1 is reverse on wave
''set timer to x if 0ed and timer is -1

seg 2 div 1 add {
dup ref minh swap sub sgn 1 add sgn mul
dup 300 add ref sgn 1 add sgn neg 1 add mul
300 add timer swap store } loop

''count down

seg 2 div 1 add {
300 add dup ref sgn 1 sub sgn 1 add mul
dup ref 1 sub swap store } loop

'mirror other side
seg 2 div 1 add { dup ref swap neg seg add 2 add store } loop
--- End code ---

basic but good enough to test with.. now lets see if i can get an ellipse as the minh to weigh against for a better looking movement in the waves

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version