Author Topic: Handy Genes  (Read 4521 times)

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Handy Genes
« on: February 21, 2005, 12:52:43 AM »
Here is my little contributation. Value freezing using inc/dec. This technique allows you to "freeze" values or to raise or lower a number to a value and then freeze it.
This is best used for when you need a value at a constant number, but without the cost of continously storring it.

' Basic method to demonstrate
' Will keep .tieloc at -1 permanently
cond
start
.tieloc *.tieloc *.tieloc div mult inc
.tieloc dec
stop

' More complex method demonstrates freezing
' at a value with .ploc=7
cond
start
' When *.ploc = 7 dec by 1
.ploc *.ploc 7 sub 1000 mult add dec
.ploc inc
stop

Primarily these are for use with SG's but I'm sure you all can find other uses for them. Unfortunantly some of the more desirable values (shoot, .tieval, up) don't allow this, so you may have to do some searching for the ones that do.

Feel free to post your own finds here. Eventually any bot posted is fair game, so the real challenge is in the use of these codes to build a true top bot.

Endy ;)

Offline Anonomous Guest Person

  • Bot Builder
  • **
  • Posts: 85
    • View Profile
Handy Genes
« Reply #1 on: February 21, 2005, 11:07:16 AM »
More specifically, it doesn't work for any memory location between 1 and 8.
Or memory locations above 1000, but that's less of an evil rule that's needed to make sure bots need to expend SOME energy and more of a safeguard.
« Last Edit: February 21, 2005, 11:07:36 AM by Anonomous Guest Person »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Handy Genes
« Reply #2 on: February 21, 2005, 05:12:28 PM »
A.G.P. SO?

Offline Anonomous Guest Person

  • Bot Builder
  • **
  • Posts: 85
    • View Profile
Handy Genes
« Reply #3 on: February 21, 2005, 06:41:12 PM »
That's rather important knowledge.
That is, knowing that one can not inc or dec the system variables 1-8.
Which means that DOES work for .tieval.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Handy Genes
« Reply #4 on: February 21, 2005, 06:51:04 PM »
ic

Guest

  • Guest
Handy Genes
« Reply #5 on: February 22, 2005, 04:34:42 PM »
Thanx, for the info. I mainly used trial and error to find out which it worked for.

Endy ;)

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Handy Genes
« Reply #6 on: March 07, 2005, 12:56:53 AM »
Figured out this handy code for use with the new version.

cond
start
-1 .shoot
*.eye5 50 sub sgn dup dup mult
*.eye5 50 sub sgn add 2 div mult store
' Compares the two and stores -1 in .shoot if *.eye5 50 >
stop

I'm currently in the process of converting as much of DIN as possible to a massive SG form. Still having some trouble with the aiming values though, can't exactly knock out the "mult mult" the same way.

Endy B)

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Handy Genes
« Reply #7 on: March 13, 2005, 12:22:16 AM »
Figured out, while waiting for sgn fix, that the square root function returns zero for anything less than 1. To give you an example:

' This yields 1 if shflav is less than 0
*.shflav sqr dup div 1 sub -1 mult *.shflav dup div mult

Alright enough math tricks, I can't be giving you all my secrets.

P.S.
Please never add imaginary numbers to DB. Even thinking of "imaginary" bots calculating imaginary numbers makes my head hurt.

Endy B)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7715
    • View Profile
Handy Genes
« Reply #8 on: March 13, 2005, 12:33:39 AM »
Imaginary numbers you say?   :whisper:  :wacko: Mwahahahahaha.

Seriously though I can't imagine any reason at all to have imaginary numbers.  Imaginary numbers aren't even useful until you get to some advanced harmonic motion differential equations.

But if you insist... :P

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
Handy Genes
« Reply #9 on: March 13, 2005, 01:45:19 PM »
What if I want a multi-bot to form up in the shape of a Mandelbrot set?

Can't do that without imaginary numbers now can I :bigginangel:

 :D  PY  :D
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Handy Genes
« Reply #10 on: March 19, 2005, 02:59:39 AM »
I'm [you]very[/you][/b] scared.

Endy B)
« Last Edit: March 19, 2005, 02:59:57 AM by Endy »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
Handy Genes
« Reply #11 on: March 19, 2005, 11:08:17 AM »
Could probably do with some Fourier Transforms too. That way I can teach my bots to ananlyze their surrounding by using the infra-red spectrum emitted by the pixels in the screen.

 B)  Fourier Transform Infra Red Spectroscopy  B)
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Handy Genes
« Reply #12 on: March 19, 2005, 05:38:55 PM »
The bots would also be able to see the mouse...that would be seriously creepy.

Endy ;)

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
Handy Genes
« Reply #13 on: March 19, 2005, 06:47:56 PM »
Sounds like you are headed into the possession thread

My suggestion there is to make a possessed robot head toward the mouse.

 :D  PY  :D
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Handy Genes
« Reply #14 on: April 16, 2005, 09:53:57 PM »
Figured out what was keeping *.shang .aimshoot store from working right. The problem is that *.shang is returning the conjugate angle, ie. (If it should be 314 it returns 942). It isn't much of a bug since to counter just subtract *.shang from 1256.


It works right but I ran into some problems with bots killing their babies; when they rotate during birthing. Anyone have any ideas let me know.

Here's what I've got so far:

cond
*.shflav 0 !=
*.shflav -2 !=
start
' Shflav stays when hit...added this checker to counter
70 *.shdx *.shsx add *.shdn *.shup add add dup div mult inc
1256 *.shang sub .aimshoot *70 mult store
-6 .shoot *70 mult store
70 *70 dup div mult dec
stop

Endy B)
« Last Edit: April 16, 2005, 09:58:21 PM by Endy »