Bots and Simulations > DNA - General

Newbye question

<< < (3/3)

Numsgil:

--- Quote from: duartel on March 29, 2011, 01:42:44 PM ---Let's see if I can explain...
It would be carnivore and canibal. It would eat any non-vegetable that he'd see.

--- End quote ---

So how do you determine if what you see is a vegetable or not?  There isn't a refvar for autotrophs, so you have to get creative (the default plant doesn't have any eyes, for instance).


--- Quote ---The exception is it's children, but only for three seconds. This is so it wouldn't eat it's own children right after they were born =p

--- End quote ---

We don't have seconds.  We have cycles (because the simulation slows down sometimes, so 3 seconds might be 300 cycles or only 2).  So sounds like you want to trigger feeding if the refage is greater than 3.


--- Quote ---The rest of the stats would be pretty low.

--- End quote ---
Stats?


--- Quote ---It would have to almost crash with something to see it

--- End quote ---

The simulation gives all bots the same view distance, so bots can "see" fairly far.  I guess you could have it ignore objects that are too far away.


--- Quote ---and would be relatively slow. But once it sees something, it starts running super fast

--- End quote ---

Easy enough if you separate out the logic for "see something I want to eat" from the logic for "randomly wander".


--- Quote ---and would strike it's victim really hard.

--- End quote ---

How does that translate into actual action?  Are you powering up shots to do more damage?  Are you ramming the other bot (which doesn't actually do damage, but would certainly look aggressive :P)


--- Quote ---It's atack would take out a lot of health from it's victim.

--- End quote ---

We don't do 'health'.  We have nrg and body, which together would be equivalent to "health".

...

If you're lucky someone might try and write your bot for you, but... probably not.  You'll probably have to open up the manual, read the pages for the different sysvars to get an idea of what sort of sense are available, and then take a crack at writing it.  It does take a bit of effort if you haven't ever programmed before, but if you have any basic ability with algebra you should be able to figure it out with some effort.  Start here and wander around the wiki for tutorials and the like, and if you have any specific questions we'll be glad to help.

Panda:
I'm actually up to writing a bot! XD With explanations!

PhiNotPi:
     Reverse Polish Notation is a system of writing math expressions so that there can be no confusion about the order of operations and no need for parentheses.  Take the expression 2 * 3 + 4, for example.  If you did not know the order of operations (it is surprisingly hard to write a program that uses the order of operations), then it would be impossible to know whether the person meant (2 * 3) + 4 (= 10) or 2 * (3 + 4).  The first one equals 10 and the second equals 14, which are not the same.  Someone could have the program just read from left to right, but this can make simple expressions much more confusing.  Parenthesis are good to avoid in Alife programs, because if the parenthesis mutate to no longer match up correctly, then the math doesn't make sense and this may cause a computer error.

     This is why DB uses Reverse Polish Notation (RPN).  In RPN, the operator (+ - * / or in DB add sub mult div) comes after the operands (the numbers or memory references), instead of in between.  The operator always effects the two operands immediately in front of it, and combines them into one operand.  With these simple rules, any expression can be formed without an order of operations or parenthesis.  (2 * 3) + 4 would be written as 2 3 mult 4 add.  It is clear that mult affects 2 and 3, while add affects the result of (2 3 mult) and 4.  The second expression, 2 * (3 + 4), would be written as 2 3 4 add mult.  It is clear that add affects 3 and 4, while mult affects 2 and (3 4 add).

     I hope that you now better understand RPN.  RPN is very easy to use, but it may take some getting used to.

Panda:
Yeah, it did for me when I first started, but now, extremely easy to use!

Navigation

[0] Message Index

[*] Previous page

Go to full version